| 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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 inifile = join('dart', 'DartEditor.app', 'Contents', 'MacOS', | 875 inifile = join('dart', 'DartEditor.app', 'Contents', 'MacOS', |
| 876 'DartEditor.ini') | 876 'DartEditor.ini') |
| 877 else: | 877 else: |
| 878 inifile = join('dart', 'DartEditor.ini') | 878 inifile = join('dart', 'DartEditor.ini') |
| 879 | 879 |
| 880 if (basename.startswith('darteditor-win32-')): | 880 if (basename.startswith('darteditor-win32-')): |
| 881 f = zipfile.ZipFile(zipFile) | 881 f = zipfile.ZipFile(zipFile) |
| 882 f.extract(inifile.replace('\\','/')) | 882 f.extract(inifile.replace('\\','/')) |
| 883 f.close() | 883 f.close() |
| 884 else: | 884 else: |
| 885 subprocess.call(['unzip', zipFile, inifile], env=os.environ) | 885 bot_utils.run(['unzip', zipFile, inifile], env=os.environ) |
| 886 | 886 |
| 887 Modify64BitDartEditorIni(inifile) | 887 Modify64BitDartEditorIni(inifile) |
| 888 | 888 |
| 889 if (basename.startswith('darteditor-win32-')): | 889 if (basename.startswith('darteditor-win32-')): |
| 890 f = zipfile.ZipFile(zipFile, 'a') | 890 seven_zip = os.path.join(DART_DIR, 'third_party', '7zip', '7za.exe') |
| 891 f.write(inifile.replace('\\','/')) | 891 bot_utils.run([seven_zip, 'd', zipFile, inifile], env=os.environ) |
| 892 f.close() | 892 bot_utils.run([seven_zip, 'a', zipFile, inifile], env=os.environ) |
| 893 else: | 893 else: |
| 894 subprocess.call(['zip', '-d', zipFile, inifile], env=os.environ) | 894 bot_utils.run(['zip', '-d', zipFile, inifile], env=os.environ) |
| 895 subprocess.call(['zip', '-q', zipFile, inifile], env=os.environ) | 895 bot_utils.run(['zip', '-q', zipFile, inifile], env=os.environ) |
| 896 | 896 |
| 897 os.remove(inifile) | 897 os.remove(inifile) |
| 898 | 898 |
| 899 # post-process the info.plist file | 899 # post-process the info.plist file |
| 900 if (basename.startswith('darteditor-macos-')): | 900 if (basename.startswith('darteditor-macos-')): |
| 901 infofile = join('dart', 'DartEditor.app', 'Contents', 'Info.plist') | 901 infofile = join('dart', 'DartEditor.app', 'Contents', 'Info.plist') |
| 902 subprocess.call(['unzip', zipFile, infofile], env=os.environ) | 902 bot_utils.run(['unzip', zipFile, infofile], env=os.environ) |
| 903 ReplaceInFiles( | 903 ReplaceInFiles( |
| 904 [infofile], | 904 [infofile], |
| 905 [('<dict>', | 905 [('<dict>', |
| 906 '<dict>\n\t<key>NSHighResolutionCapable</key>\n\t\t<true/>')]) | 906 '<dict>\n\t<key>NSHighResolutionCapable</key>\n\t\t<true/>')]) |
| 907 subprocess.call(['zip', '-q', zipFile, infofile], env=os.environ) | 907 bot_utils.run(['zip', '-q', zipFile, infofile], env=os.environ) |
| 908 os.remove(infofile) | 908 os.remove(infofile) |
| 909 | 909 |
| 910 | 910 |
| 911 def Modify64BitDartEditorIni(iniFilePath): | 911 def Modify64BitDartEditorIni(iniFilePath): |
| 912 f = open(iniFilePath, 'r') | 912 f = open(iniFilePath, 'r') |
| 913 lines = f.readlines() | 913 lines = f.readlines() |
| 914 f.close() | 914 f.close() |
| 915 lines[lines.index('-Xms40m\n')] = '-Xms256m\n' | 915 lines[lines.index('-Xms40m\n')] = '-Xms256m\n' |
| 916 lines[lines.index('-Xmx1000m\n')] = '-Xmx2000m\n' | 916 lines[lines.index('-Xmx1000m\n')] = '-Xmx2000m\n' |
| 917 f = open(iniFilePath, 'w') | 917 f = open(iniFilePath, 'w') |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 """delete the given file - do not re-throw any exceptions that occur""" | 1261 """delete the given file - do not re-throw any exceptions that occur""" |
| 1262 if os.path.exists(f): | 1262 if os.path.exists(f): |
| 1263 try: | 1263 try: |
| 1264 os.remove(f) | 1264 os.remove(f) |
| 1265 except OSError: | 1265 except OSError: |
| 1266 print 'error deleting %s' % f | 1266 print 'error deleting %s' % f |
| 1267 | 1267 |
| 1268 | 1268 |
| 1269 if __name__ == '__main__': | 1269 if __name__ == '__main__': |
| 1270 sys.exit(main()) | 1270 sys.exit(main()) |
| OLD | NEW |