| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (C) 2009 Google Inc. All rights reserved. | 3 # Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 # following the final '--'. | 80 # following the final '--'. |
| 81 args = [] | 81 args = [] |
| 82 sections.append(args) | 82 sections.append(args) |
| 83 else: | 83 else: |
| 84 args = args[dashes + 1:] | 84 args = args[dashes + 1:] |
| 85 | 85 |
| 86 return sections | 86 return sections |
| 87 | 87 |
| 88 | 88 |
| 89 def main(args): | 89 def main(args): |
| 90 sections = SplitArgsIntoSections(args[1:]) | 90 if args[1] != "--idlToPathFile" or len(args) < 3: |
| 91 print "FATAL: Missing --idlToPathFile argument: " + str(args) |
| 92 return 1 |
| 93 os.environ["IDLTOPATHFILE"] = args[2] |
| 94 sections = SplitArgsIntoSections(args[3:]) |
| 91 assert len(sections) == 2 or len(sections) == 3 | 95 assert len(sections) == 2 or len(sections) == 3 |
| 92 (outputs, inputs) = sections[:2] | 96 (outputs, inputs) = sections[:2] |
| 93 if len(sections) == 3: | 97 if len(sections) == 3: |
| 94 options = sections[2] | 98 options = sections[2] |
| 95 else: | 99 else: |
| 96 options = [] | 100 options = [] |
| 97 | 101 |
| 98 # Make all output pathnames absolute so that they can be accessed after | 102 # Make all output pathnames absolute so that they can be accessed after |
| 99 # changing directory. | 103 # changing directory. |
| 100 for index in xrange(0, len(outputs)): | 104 for index in xrange(0, len(outputs)): |
| (...skipping 23 matching lines...) Expand all Loading... |
| 124 assert tagInput == None | 128 assert tagInput == None |
| 125 tagInput = inputAbsPosix | 129 tagInput = inputAbsPosix |
| 126 elif inputBasename.endswith('AttributeNames.in') or inputBasename.endswi
th('attrs.in'): | 130 elif inputBasename.endswith('AttributeNames.in') or inputBasename.endswi
th('attrs.in'): |
| 127 assert attrInput == None | 131 assert attrInput == None |
| 128 attrInput = inputAbsPosix | 132 attrInput = inputAbsPosix |
| 129 elif (inputBasename.endswith('EventTargetFactory.in') or inputBasename.e
ndswith('EventNames.in') | 133 elif (inputBasename.endswith('EventTargetFactory.in') or inputBasename.e
ndswith('EventNames.in') |
| 130 or inputBasename.endswith('DOMExceptions.in') or inputBasename.endsw
ith('Settings.in')): | 134 or inputBasename.endswith('DOMExceptions.in') or inputBasename.endsw
ith('Settings.in')): |
| 131 eventsInput = inputAbsPosix | 135 eventsInput = inputAbsPosix |
| 132 elif inputBasename.endswith('Names.in'): | 136 elif inputBasename.endswith('Names.in'): |
| 133 options.append(inputAbsPosix) | 137 options.append(inputAbsPosix) |
| 134 elif inputBasename.endswith('.pm'): | 138 elif inputBasename.endswith('.pm') or inputBasename.endswith('.py'): |
| 135 continue | 139 continue |
| 136 else: | 140 else: |
| 137 assert False | 141 assert False, "Unexcepted file type "+ inputeBasename |
| 138 | 142 |
| 139 assert makeNamesInput != None | 143 assert makeNamesInput != None |
| 140 assert tagInput != None or attrInput != None or eventsInput != None or ('--f
onts' in options) | 144 assert tagInput != None or attrInput != None or eventsInput != None or ('--f
onts' in options) |
| 141 | 145 |
| 142 # scriptsPath is a Perl include directory, located relative to | 146 # scriptsPath is a Perl include directory, located relative to |
| 143 # makeNamesInput. | 147 # makeNamesInput. |
| 144 scriptsPath = os.path.normpath( | 148 scriptsPath = os.path.normpath( |
| 145 os.path.join(os.path.dirname(makeNamesInput), os.pardir, 'scripts')) | 149 os.path.join(os.path.dirname(makeNamesInput), os.pardir, 'scripts')) |
| 146 | 150 |
| 147 # Change to the output directory because make_names.pl puts output in its | 151 # Change to the output directory because make_names.pl puts output in its |
| (...skipping 25 matching lines...) Expand all Loading... |
| 173 src = os.path.join(outputDir, outputBasename) | 177 src = os.path.join(outputDir, outputBasename) |
| 174 dst = os.path.join(thisOutputDir, outputBasename) | 178 dst = os.path.join(thisOutputDir, outputBasename) |
| 175 shutil.copyfile(src, dst) | 179 shutil.copyfile(src, dst) |
| 176 os.unlink(src) | 180 os.unlink(src) |
| 177 | 181 |
| 178 return returnCode | 182 return returnCode |
| 179 | 183 |
| 180 | 184 |
| 181 if __name__ == '__main__': | 185 if __name__ == '__main__': |
| 182 sys.exit(main(sys.argv)) | 186 sys.exit(main(sys.argv)) |
| OLD | NEW |