| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, 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 import glob | 7 import glob |
| 8 import gsutil | 8 import gsutil |
| 9 import imp | 9 import imp |
| 10 import optparse | 10 import optparse |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 | 861 |
| 862 | 862 |
| 863 def PostProcessEditorBuilds(out_dir): | 863 def PostProcessEditorBuilds(out_dir): |
| 864 """Post-process the created RCP builds""" | 864 """Post-process the created RCP builds""" |
| 865 | 865 |
| 866 for zipFile in _FindRcpZipFiles(out_dir): | 866 for zipFile in _FindRcpZipFiles(out_dir): |
| 867 basename = os.path.basename(zipFile) | 867 basename = os.path.basename(zipFile) |
| 868 | 868 |
| 869 print(' processing %s' % basename) | 869 print(' processing %s' % basename) |
| 870 | 870 |
| 871 # adjust memory params for 64 bit versions |
| 872 if (basename.endswith('-64.zip')): |
| 873 if (basename.startswith('darteditor-macos-')): |
| 874 inifile = join('dart', 'DartEditor.app', 'Contents', 'MacOS', |
| 875 'DartEditor.ini') |
| 876 else: |
| 877 inifile = join('dart', 'DartEditor.ini') |
| 878 |
| 879 if (basename.startswith('darteditor-win32-')): |
| 880 f = zipfile.ZipFile(zipFile) |
| 881 f.extract(inifile) |
| 882 f.close() |
| 883 else: |
| 884 subprocess.call(['unzip', zipFile, inifile], env=os.environ) |
| 885 |
| 886 Modify64BitDartEditorIni(inifile) |
| 887 |
| 888 if (basename.startswith('darteditor-win32-')): |
| 889 f = zipfile.ZipFile(zipFile) |
| 890 f.write(inifile) |
| 891 f.close() |
| 892 else: |
| 893 subprocess.call(['zip', '-d', zipFile, inifile], env=os.environ) |
| 894 subprocess.call(['zip', '-q', zipFile, inifile], env=os.environ) |
| 895 |
| 896 os.remove(inifile) |
| 897 |
| 871 # post-process the info.plist file | 898 # post-process the info.plist file |
| 872 if (basename.startswith('darteditor-macos-')): | 899 if (basename.startswith('darteditor-macos-')): |
| 873 infofile = join('dart', 'DartEditor.app', 'Contents', 'Info.plist') | 900 infofile = join('dart', 'DartEditor.app', 'Contents', 'Info.plist') |
| 874 subprocess.call(['unzip', zipFile, infofile], env=os.environ) | 901 subprocess.call(['unzip', zipFile, infofile], env=os.environ) |
| 875 ReplaceInFiles( | 902 ReplaceInFiles( |
| 876 [infofile], | 903 [infofile], |
| 877 [('<dict>', | 904 [('<dict>', |
| 878 '<dict>\n\t<key>NSHighResolutionCapable</key>\n\t\t<true/>')]) | 905 '<dict>\n\t<key>NSHighResolutionCapable</key>\n\t\t<true/>')]) |
| 879 subprocess.call(['zip', '-q', zipFile, infofile], env=os.environ) | 906 subprocess.call(['zip', '-q', zipFile, infofile], env=os.environ) |
| 880 os.remove(infofile) | 907 os.remove(infofile) |
| 881 | 908 |
| 882 | 909 |
| 910 def Modify64BitDartEditorIni(iniFilePath): |
| 911 f = open(iniFilePath, 'r') |
| 912 lines = f.readlines() |
| 913 f.close() |
| 914 lines[lines.index('-Xms40m\n')] = '-Xms256m\n' |
| 915 lines[lines.index('-Xmx1000m\n')] = '-Xmx2000m\n' |
| 916 f = open(iniFilePath, 'w') |
| 917 f.writelines(lines); |
| 918 f.close() |
| 919 |
| 920 |
| 883 def RunEditorTests(buildout, buildos): | 921 def RunEditorTests(buildout, buildos): |
| 884 StartBuildStep('run_tests') | 922 StartBuildStep('run_tests') |
| 885 | 923 |
| 886 for editorArchive in _GetTestableRcpArchives(buildout): | 924 for editorArchive in _GetTestableRcpArchives(buildout): |
| 887 with utils.TempDir('editor_') as tempDir: | 925 with utils.TempDir('editor_') as tempDir: |
| 888 print 'Running tests for %s...' % editorArchive | 926 print 'Running tests for %s...' % editorArchive |
| 889 | 927 |
| 890 zipper = ziputils.ZipUtil(join(buildout, editorArchive), buildos) | 928 zipper = ziputils.ZipUtil(join(buildout, editorArchive), buildos) |
| 891 zipper.UnZip(tempDir) | 929 zipper.UnZip(tempDir) |
| 892 | 930 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 """delete the given file - do not re-throw any exceptions that occur""" | 1260 """delete the given file - do not re-throw any exceptions that occur""" |
| 1223 if os.path.exists(f): | 1261 if os.path.exists(f): |
| 1224 try: | 1262 try: |
| 1225 os.remove(f) | 1263 os.remove(f) |
| 1226 except OSError: | 1264 except OSError: |
| 1227 print 'error deleting %s' % f | 1265 print 'error deleting %s' % f |
| 1228 | 1266 |
| 1229 | 1267 |
| 1230 if __name__ == '__main__': | 1268 if __name__ == '__main__': |
| 1231 sys.exit(main()) | 1269 sys.exit(main()) |
| OLD | NEW |