Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Side by Side Diff: native_client_sdk/src/build_tools/build_sdk.py

Issue 720233003: [NaCl SDK] Convert python scripts from optparse to argparse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """Entry point for both build and try bots. 6 """Entry point for both build and try bots.
7 7
8 This script is invoked from XXX, usually without arguments 8 This script is invoked from XXX, usually without arguments
9 to package an SDK. It automatically determines whether 9 to package an SDK. It automatically determines whether
10 this SDK is for mac, win, linux. 10 this SDK is for mac, win, linux.
11 11
12 The script inspects the following environment variables: 12 The script inspects the following environment variables:
13 13
14 BUILDBOT_BUILDERNAME to determine whether the script is run locally 14 BUILDBOT_BUILDERNAME to determine whether the script is run locally
15 and whether it should upload an SDK to file storage (GSTORE) 15 and whether it should upload an SDK to file storage (GSTORE)
16 """ 16 """
17 17
18 # pylint: disable=W0621 18 # pylint: disable=W0621
19 19
20 # std python includes 20 # std python includes
21 import argparse
21 import datetime 22 import datetime
22 import glob 23 import glob
23 import optparse
24 import os 24 import os
25 import re 25 import re
26 import sys 26 import sys
27 27
28 if sys.version_info < (2, 7, 0): 28 if sys.version_info < (2, 7, 0):
29 sys.stderr.write("python 2.7 or later is required run this script\n") 29 sys.stderr.write("python 2.7 or later is required run this script\n")
30 sys.exit(1) 30 sys.exit(1)
31 31
32 # local includes 32 # local includes
33 import buildbot_common 33 import buildbot_common
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 """Build the projects found in src/gonacl_appengine/src""" 896 """Build the projects found in src/gonacl_appengine/src"""
897 buildbot_common.BuildStep('Build GoNaCl AppEngine Projects') 897 buildbot_common.BuildStep('Build GoNaCl AppEngine Projects')
898 cmd = ['make', 'upload', 'REVISION=%s' % chrome_revision] 898 cmd = ['make', 'upload', 'REVISION=%s' % chrome_revision]
899 env = dict(os.environ) 899 env = dict(os.environ)
900 env['NACL_SDK_ROOT'] = pepperdir 900 env['NACL_SDK_ROOT'] = pepperdir
901 env['NACLPORTS_NO_ANNOTATE'] = "1" 901 env['NACLPORTS_NO_ANNOTATE'] = "1"
902 buildbot_common.Run(cmd, env=env, cwd=GONACL_APPENGINE_SRC_DIR) 902 buildbot_common.Run(cmd, env=env, cwd=GONACL_APPENGINE_SRC_DIR)
903 903
904 904
905 def main(args): 905 def main(args):
906 parser = optparse.OptionParser(description=__doc__) 906 parser = argparse.ArgumentParser(description=__doc__)
907 parser.add_option('--nacl-tree-path', 907 parser.add_argument('--nacl-tree-path',
908 help='Path to native client tree for bionic build.', 908 help='Path to native client tree for bionic build.',
909 dest='nacl_tree_path') 909 dest='nacl_tree_path')
910 parser.add_option('--qemu', help='Add qemu for ARM.', 910 parser.add_argument('--qemu', help='Add qemu for ARM.',
911 action='store_true') 911 action='store_true')
912 parser.add_option('--bionic', help='Add bionic build.', 912 parser.add_argument('--bionic', help='Add bionic build.',
913 action='store_true') 913 action='store_true')
914 parser.add_option('--tar', help='Force the tar step.', 914 parser.add_argument('--tar', help='Force the tar step.',
915 action='store_true') 915 action='store_true')
916 parser.add_option('--archive', help='Force the archive step.', 916 parser.add_argument('--archive', help='Force the archive step.',
917 action='store_true') 917 action='store_true')
918 parser.add_option('--release', help='PPAPI release version.', 918 parser.add_argument('--release', help='PPAPI release version.',
919 dest='release', default=None) 919 dest='release', default=None)
920 parser.add_option('--build-ports', 920 parser.add_argument('--build-ports',
921 help='Build naclport bundle.', action='store_true') 921 help='Build naclport bundle.', action='store_true')
922 parser.add_option('--build-app-engine', 922 parser.add_argument('--build-app-engine',
923 help='Build AppEngine demos.', action='store_true') 923 help='Build AppEngine demos.', action='store_true')
924 parser.add_option('--experimental', 924 parser.add_argument('--experimental',
925 help='build experimental examples and libraries', action='store_true', 925 help='build experimental examples and libraries', action='store_true',
926 dest='build_experimental') 926 dest='build_experimental')
927 parser.add_option('--skip-toolchain', help='Skip toolchain untar', 927 parser.add_argument('--skip-toolchain', help='Skip toolchain untar',
928 action='store_true') 928 action='store_true')
929 parser.add_option('--mac-sdk', 929 parser.add_argument('--mac-sdk',
930 help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.') 930 help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.')
931 parser.add_option('--no-arm-trusted', action='store_true', 931 parser.add_argument('--no-arm-trusted', action='store_true',
932 help='Disable building of ARM trusted components (sel_ldr, etc).') 932 help='Disable building of ARM trusted components (sel_ldr, etc).')
933 933
934 # To setup bash completion for this command first install optcomplete 934 # To setup bash completion for this command first install optcomplete
935 # and then add this line to your .bashrc: 935 # and then add this line to your .bashrc:
936 # complete -F _optcomplete build_sdk.py 936 # complete -F _optcomplete build_sdk.py
937 try: 937 try:
938 import optcomplete 938 import optcomplete
939 optcomplete.autocomplete(parser) 939 optcomplete.autocomplete(parser)
940 except ImportError: 940 except ImportError:
941 pass 941 pass
942 942
943 global options 943 global options
944 options, args = parser.parse_args(args) 944 options = parser.parse_args(args)
945 if args:
946 parser.error("Unexpected arguments: %s" % str(args))
947 945
948 if options.nacl_tree_path: 946 if options.nacl_tree_path:
949 options.bionic = True 947 options.bionic = True
950 toolchain_build = os.path.join(options.nacl_tree_path, 'toolchain_build') 948 toolchain_build = os.path.join(options.nacl_tree_path, 'toolchain_build')
951 print 'WARNING: Building bionic toolchain from NaCl checkout.' 949 print 'WARNING: Building bionic toolchain from NaCl checkout.'
952 print 'This option builds bionic from the sources currently in the' 950 print 'This option builds bionic from the sources currently in the'
953 print 'provided NativeClient checkout, and the results instead of ' 951 print 'provided NativeClient checkout, and the results instead of '
954 print 'downloading a toolchain from the builder. This may result in a' 952 print 'downloading a toolchain from the builder. This may result in a'
955 print 'NaCl SDK that can not run on ToT chrome.' 953 print 'NaCl SDK that can not run on ToT chrome.'
956 print 'NOTE: To clobber you will need to run toolchain_build_bionic.py' 954 print 'NOTE: To clobber you will need to run toolchain_build_bionic.py'
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 BuildStepArchiveSDKTools() 1070 BuildStepArchiveSDKTools()
1073 1071
1074 return 0 1072 return 0
1075 1073
1076 1074
1077 if __name__ == '__main__': 1075 if __name__ == '__main__':
1078 try: 1076 try:
1079 sys.exit(main(sys.argv[1:])) 1077 sys.exit(main(sys.argv[1:]))
1080 except KeyboardInterrupt: 1078 except KeyboardInterrupt:
1081 buildbot_common.ErrorExit('build_sdk: interrupted') 1079 buildbot_common.ErrorExit('build_sdk: interrupted')
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/build_projects.py ('k') | native_client_sdk/src/build_tools/build_updater.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698