OLD | NEW |
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 """Meta checkout manager supporting both Subversion and GIT. | 6 """Meta checkout manager supporting both Subversion and GIT. |
7 | 7 |
8 Files | 8 Files |
9 .gclient : Current client configuration, written by 'config' command. | 9 .gclient : Current client configuration, written by 'config' command. |
10 Format is a Python script defining 'solutions', a list whose | 10 Format is a Python script defining 'solutions', a list whose |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 "action": ["python", "image_indexer.py", "--all"]}, | 48 "action": ["python", "image_indexer.py", "--all"]}, |
49 ] | 49 ] |
50 """ | 50 """ |
51 | 51 |
52 __version__ = "0.6.4" | 52 __version__ = "0.6.4" |
53 | 53 |
54 import copy | 54 import copy |
55 import logging | 55 import logging |
56 import optparse | 56 import optparse |
57 import os | 57 import os |
| 58 import platform |
58 import posixpath | 59 import posixpath |
59 import pprint | 60 import pprint |
60 import re | 61 import re |
61 import sys | 62 import sys |
| 63 import urllib |
62 import urlparse | 64 import urlparse |
63 import urllib | |
64 | 65 |
65 import breakpad # pylint: disable=W0611 | 66 import breakpad # pylint: disable=W0611 |
66 | 67 |
67 import fix_encoding | 68 import fix_encoding |
68 import gclient_scm | 69 import gclient_scm |
69 import gclient_utils | 70 import gclient_utils |
70 from third_party.repo.progress import Progress | 71 from third_party.repo.progress import Progress |
71 import subprocess2 | 72 import subprocess2 |
72 from third_party import colorama | 73 from third_party import colorama |
73 # Import shortcut. | 74 # Import shortcut. |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 # OptParser.description prefer nicely non-formatted strings. | 1492 # OptParser.description prefer nicely non-formatted strings. |
1492 parser.description = re.sub('[\r\n ]{2,}', ' ', obj.__doc__) | 1493 parser.description = re.sub('[\r\n ]{2,}', ' ', obj.__doc__) |
1493 usage = getattr(obj, 'usage', '') | 1494 usage = getattr(obj, 'usage', '') |
1494 parser.set_usage('%%prog %s [options] %s' % (command, usage)) | 1495 parser.set_usage('%%prog %s [options] %s' % (command, usage)) |
1495 parser.epilog = getattr(obj, 'epilog', None) | 1496 parser.epilog = getattr(obj, 'epilog', None) |
1496 | 1497 |
1497 | 1498 |
1498 def Parser(): | 1499 def Parser(): |
1499 """Returns the default parser.""" | 1500 """Returns the default parser.""" |
1500 parser = optparse.OptionParser(version='%prog ' + __version__) | 1501 parser = optparse.OptionParser(version='%prog ' + __version__) |
1501 # cygwin has issues with parallel sync | 1502 # cygwin and some arm boards have issues with parallel sync. |
1502 jobs = 1 if sys.platform == 'cygwin' else 8 | 1503 if sys.platform == 'cygwin' or platform.machine().startswith('arm'): |
| 1504 jobs = 1 |
| 1505 else: |
| 1506 jobs = 8 |
1503 parser.add_option('-j', '--jobs', default=jobs, type='int', | 1507 parser.add_option('-j', '--jobs', default=jobs, type='int', |
1504 help='Specify how many SCM commands can run in parallel; ' | 1508 help='Specify how many SCM commands can run in parallel; ' |
1505 'default=%default') | 1509 'default=%default') |
1506 parser.add_option('-v', '--verbose', action='count', default=0, | 1510 parser.add_option('-v', '--verbose', action='count', default=0, |
1507 help='Produces additional output for diagnostics. Can be ' | 1511 help='Produces additional output for diagnostics. Can be ' |
1508 'used up to three times for more logging info.') | 1512 'used up to three times for more logging info.') |
1509 parser.add_option('--gclientfile', dest='config_filename', | 1513 parser.add_option('--gclientfile', dest='config_filename', |
1510 default=os.environ.get('GCLIENT_FILE', '.gclient'), | 1514 default=os.environ.get('GCLIENT_FILE', '.gclient'), |
1511 help='Specify an alternate %default file') | 1515 help='Specify an alternate %default file') |
1512 # Integrate standard options processing. | 1516 # Integrate standard options processing. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1585 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1582 print >> sys.stderr, 'Error: %s' % str(e) | 1586 print >> sys.stderr, 'Error: %s' % str(e) |
1583 return 1 | 1587 return 1 |
1584 | 1588 |
1585 | 1589 |
1586 if '__main__' == __name__: | 1590 if '__main__' == __name__: |
1587 fix_encoding.fix_encoding() | 1591 fix_encoding.fix_encoding() |
1588 sys.exit(Main(sys.argv[1:])) | 1592 sys.exit(Main(sys.argv[1:])) |
1589 | 1593 |
1590 # vim: ts=2:sw=2:tw=80:et: | 1594 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |