| Index: gsutil.py
|
| ===================================================================
|
| --- gsutil.py (revision 33376)
|
| +++ gsutil.py (working copy)
|
| @@ -1,5 +1,5 @@
|
| #!/usr/bin/env python
|
| -# coding=utf8
|
| +# -*- coding: utf-8 -*-
|
| # Copyright 2010 Google Inc. All Rights Reserved.
|
| #
|
| # Licensed under the Apache License, Version 2.0 (the "License");
|
| @@ -20,25 +20,26 @@
|
| import sys
|
| import warnings
|
|
|
| +# TODO: gsutil-beta: Distribute a pylint rc file.
|
|
|
| if not (2, 6) <= sys.version_info[:3] < (3,):
|
| sys.exit('gsutil requires python 2.6 or 2.7.')
|
|
|
|
|
| -def UsingCrcmodExtension(crcmod):
|
| - return (getattr(crcmod, 'crcmod', None) and
|
| - getattr(crcmod.crcmod, '_usingExtension', None))
|
| +def UsingCrcmodExtension(crcmod_module):
|
| + return (getattr(crcmod_module, 'crcmod', None) and
|
| + getattr(crcmod_module.crcmod, '_usingExtension', None))
|
|
|
|
|
| -def _OutputAndExit(message):
|
| +def OutputAndExit(message):
|
| sys.stderr.write('%s\n' % message)
|
| sys.exit(1)
|
|
|
|
|
| GSUTIL_DIR = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
|
| if not GSUTIL_DIR:
|
| - _OutputAndExit('Unable to determine where gsutil is installed. Sorry, '
|
| - 'cannot run correctly without this.\n')
|
| + OutputAndExit('Unable to determine where gsutil is installed. Sorry, '
|
| + 'cannot run correctly without this.\n')
|
|
|
| # The wrapper script adds all third_party libraries to the Python path, since
|
| # we don't assume any third party libraries are installed system-wide.
|
| @@ -57,16 +58,17 @@
|
| # the directory under third_party and the second element is the subdirectory
|
| # that needs to be added to sys.path.
|
| THIRD_PARTY_LIBS = [
|
| + ('google-api-python-client', ''), # Must be before boto.
|
| + ('boto', ''),
|
| + ('gcs-oauth2-boto-plugin', ''),
|
| + ('httplib2', 'python2'),
|
| ('python-gflags', ''),
|
| - ('google-api-python-client', ''),
|
| - ('httplib2', 'python2'),
|
| - ('boto', ''),
|
| + ('retry-decorator', ''),
|
| ('socksipy-branch', ''),
|
| - ('retry-decorator', ''),
|
| ]
|
| for libdir, subdir in THIRD_PARTY_LIBS:
|
| if not os.path.isdir(os.path.join(THIRD_PARTY_DIR, libdir)):
|
| - _OutputAndExit(
|
| + OutputAndExit(
|
| 'There is no %s library under the gsutil third-party directory (%s).\n'
|
| 'The gsutil command cannot work properly when installed this way.\n'
|
| 'Please re-install gsutil per the installation instructions.' % (
|
| @@ -81,6 +83,7 @@
|
| CRCMOD_OSX_PATH = os.path.join(THIRD_PARTY_DIR, 'crcmod_osx')
|
|
|
| try:
|
| + # pylint: disable=g-import-not-at-top
|
| import crcmod
|
| except ImportError:
|
| crcmod = None
|
| @@ -91,7 +94,9 @@
|
| else CRCMOD_PATH)
|
| sys.path.insert(0, local_crcmod_path)
|
|
|
| +
|
| def RunMain():
|
| + # pylint: disable=g-import-not-at-top
|
| import gslib.__main__
|
| sys.exit(gslib.__main__.main())
|
|
|
|
|