| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 # A script to generate a windows installer for the editor bundle. | 7 # A script to generate a windows installer for the editor bundle. |
| 8 # As input the script takes a zip file, a version and the location | 8 # As input the script takes a zip file, a version and the location |
| 9 # to store the resulting msi file in. | 9 # to store the resulting msi file in. |
| 10 # | 10 # |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 ExtractZipFile(options.zip_file_location, temp_dir) | 76 ExtractZipFile(options.zip_file_location, temp_dir) |
| 77 return os.path.join(temp_dir, 'dart') | 77 return os.path.join(temp_dir, 'dart') |
| 78 return options.input_directory | 78 return options.input_directory |
| 79 | 79 |
| 80 # We combine the build and patch into a single entry since | 80 # We combine the build and patch into a single entry since |
| 81 # the windows installer does _not_ consider a change in Patch | 81 # the windows installer does _not_ consider a change in Patch |
| 82 # to require a new install. | 82 # to require a new install. |
| 83 # In addition to that, the limits on the size are: | 83 # In addition to that, the limits on the size are: |
| 84 # Major: 256 | 84 # Major: 256 |
| 85 # Minor: 256 | 85 # Minor: 256 |
| 86 # Patch: 65536 | 86 # Build: 65536 |
| 87 # To circumvent this we create the version like this: | 87 # To circumvent this we create the version like this: |
| 88 # Major.Minor.X | 88 # Major.Minor.X |
| 89 # from "major.minor.patch-prerelease.prerelease_patch" | 89 # where X is Build<<9 + Patch |
| 90 # where X is "patch<<10 + prerelease<<5 + prerelease_patch" | 90 # Example version 1.2.4.14 will go to 1.2.2062 |
| 91 # Example version 1.2.4-dev.2.3 will go to 1.2.4163 | |
| 92 def GetMicrosoftProductVersion(version): | 91 def GetMicrosoftProductVersion(version): |
| 93 version_parts = version.split('.') | 92 version_parts = version.split('.') |
| 94 if len(version_parts) is not 5: | 93 if len(version_parts) is not 4: |
| 95 raise Exception( | 94 raise Exception( |
| 96 "Version string (%s) does not follow specification" % version) | 95 "Version string (%s) does not follow specification" % version) |
| 97 (major, minor, patch, prerelease, prerelease_patch) = map(int, version_parts) | 96 (major, minor, build, patch) = map(int, version_parts) |
| 98 | 97 |
| 98 if build > 127 or patch > 511: |
| 99 raise Exception('Build/Patch can not be above 127/511') |
| 99 if major > 255 or minor > 255: | 100 if major > 255 or minor > 255: |
| 100 raise Exception('Major/Minor can not be above 256') | 101 raise Exception('Major/Minor can not be above 256') |
| 101 if patch > 63: | |
| 102 raise Exception('Patch can not be above 63') | |
| 103 if prerelease > 31: | |
| 104 raise Exception('Prerelease can not be above 31') | |
| 105 if prerelease_patch > 31: | |
| 106 raise Exception('PrereleasePatch can not be above 31') | |
| 107 | 102 |
| 108 combined = (patch << 10) + (prerelease << 5) + prerelease_patch | 103 combined = (build << 9) + patch |
| 109 return '%s.%s.%s' % (major, minor, combined) | 104 return '%s.%s.%s' % (major, minor, combined) |
| 110 | 105 |
| 111 # Append using the current indentation level | 106 # Append using the current indentation level |
| 112 def Append(data, new_line=True): | 107 def Append(data, new_line=True): |
| 113 str = ((' ' * current_indentation) + | 108 str = ((' ' * current_indentation) + |
| 114 data + | 109 data + |
| 115 ('\n' if new_line else '')) | 110 ('\n' if new_line else '')) |
| 116 xml_content.append(str) | 111 xml_content.append(str) |
| 117 | 112 |
| 118 # Append without any indentation at the current position | 113 # Append without any indentation at the current position |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 # We have only one feature and that consist of all the | 378 # We have only one feature and that consist of all the |
| 384 # files=components we have listed above" | 379 # files=components we have listed above" |
| 385 ComponentRefs() | 380 ComponentRefs() |
| 386 xml = GetContent() | 381 xml = GetContent() |
| 387 if options.print_wxs: | 382 if options.print_wxs: |
| 388 print xml | 383 print xml |
| 389 GenerateInstaller(xml, options, temp_dir) | 384 GenerateInstaller(xml, options, temp_dir) |
| 390 | 385 |
| 391 if __name__ == '__main__': | 386 if __name__ == '__main__': |
| 392 sys.exit(Main(sys.argv)) | 387 sys.exit(Main(sys.argv)) |
| OLD | NEW |