Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | |
| 6 import json | 7 import json |
| 7 import optparse | |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import sys | 10 import sys |
| 11 | 11 |
| 12 if sys.version_info < (2, 6, 0): | 12 if sys.version_info < (2, 6, 0): |
|
binji
2014/11/13 23:57:01
bump all of these to 2.7.0
Sam Clegg
2014/11/15 02:28:25
Split this into a separate change
| |
| 13 sys.stderr.write("python 2.6 or later is required run this script\n") | 13 sys.stderr.write("python 2.6 or later is required run this script\n") |
| 14 sys.exit(1) | 14 sys.exit(1) |
| 15 | 15 |
| 16 import buildbot_common | 16 import buildbot_common |
| 17 import build_projects | 17 import build_projects |
| 18 import build_version | 18 import build_version |
| 19 import easy_template | 19 import easy_template |
| 20 import parse_dsc | 20 import parse_dsc |
| 21 | 21 |
| 22 from build_paths import SDK_SRC_DIR, OUT_DIR, SDK_RESOURCE_DIR | 22 from build_paths import SDK_SRC_DIR, OUT_DIR, SDK_RESOURCE_DIR |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 def GetStrip(pepperdir, platform, arch, toolchain): | 70 def GetStrip(pepperdir, platform, arch, toolchain): |
| 71 base_arch = {'x86_32': 'x86', 'x86_64': 'x86', 'arm': 'arm'}[arch] | 71 base_arch = {'x86_32': 'x86', 'x86_64': 'x86', 'arm': 'arm'}[arch] |
| 72 bin_dir = os.path.join(pepperdir, 'toolchain', | 72 bin_dir = os.path.join(pepperdir, 'toolchain', |
| 73 '%s_%s_%s' % (platform, base_arch, toolchain), 'bin') | 73 '%s_%s_%s' % (platform, base_arch, toolchain), 'bin') |
| 74 strip_prefix = {'x86_32': 'i686', 'x86_64': 'x86_64', 'arm': 'arm'}[arch] | 74 strip_prefix = {'x86_32': 'i686', 'x86_64': 'x86_64', 'arm': 'arm'}[arch] |
| 75 strip_name = '%s-nacl-strip' % strip_prefix | 75 strip_name = '%s-nacl-strip' % strip_prefix |
| 76 return os.path.join(bin_dir, strip_name) | 76 return os.path.join(bin_dir, strip_name) |
| 77 | 77 |
| 78 | 78 |
| 79 def main(args): | 79 def main(args): |
| 80 parser = optparse.OptionParser() | 80 parser = argparse.ArgumentParser() |
| 81 parser.add_option('-c', '--channel', | 81 parser.add_argument('-c', '--channel', |
| 82 help='Channel to display in the name of the package.') | 82 help='Channel to display in the name of the package.') |
| 83 | 83 |
| 84 # To setup bash completion for this command first install optcomplete | 84 # To setup bash completion for this command first install optcomplete |
| 85 # and then add this line to your .bashrc: | 85 # and then add this line to your .bashrc: |
| 86 # complete -F _optcomplete build_app.py | 86 # complete -F _optcomplete build_app.py |
| 87 try: | 87 try: |
| 88 import optcomplete | 88 import optcomplete |
| 89 optcomplete.autocomplete(parser) | 89 optcomplete.autocomplete(parser) |
| 90 except ImportError: | 90 except ImportError: |
| 91 pass | 91 pass |
| 92 | 92 |
| 93 options, args = parser.parse_args(args[1:]) | 93 options = parser.parse_args(args) |
| 94 | 94 |
| 95 if options.channel: | 95 if options.channel: |
| 96 if options.channel not in ('Dev', 'Beta'): | 96 if options.channel not in ('Dev', 'Beta'): |
| 97 parser.error('Unknown channel: %s' % options.channel) | 97 parser.error('Unknown channel: %s' % options.channel) |
| 98 | 98 |
| 99 toolchains = ['newlib', 'glibc'] | 99 toolchains = ['newlib', 'glibc'] |
| 100 | 100 |
| 101 pepper_ver = str(int(build_version.ChromeMajorVersion())) | 101 pepper_ver = str(int(build_version.ChromeMajorVersion())) |
| 102 pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) | 102 pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) |
| 103 app_dir = os.path.join(OUT_DIR, 'naclsdk_app') | 103 app_dir = os.path.join(OUT_DIR, 'naclsdk_app') |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 template_dict) | 174 template_dict) |
| 175 | 175 |
| 176 app_zip = os.path.join(app_dir, 'examples.zip') | 176 app_zip = os.path.join(app_dir, 'examples.zip') |
| 177 os.chdir(app_examples_dir) | 177 os.chdir(app_examples_dir) |
| 178 oshelpers.Zip([app_zip, '-r', '*']) | 178 oshelpers.Zip([app_zip, '-r', '*']) |
| 179 | 179 |
| 180 return 0 | 180 return 0 |
| 181 | 181 |
| 182 | 182 |
| 183 if __name__ == '__main__': | 183 if __name__ == '__main__': |
| 184 sys.exit(main(sys.argv)) | 184 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |