| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
| 3 # Copyright 2011 Google Inc. | 3 # Copyright 2011 Google Inc. All Rights Reserved. |
| 4 # | 4 # |
| 5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
| 7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
| 8 # | 8 # |
| 9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 # | 10 # |
| 11 # Unless required by applicable law or agreed to in writing, software | 11 # Unless required by applicable law or agreed to in writing, software |
| 12 # distributed under the License is distributed on an "AS IS" BASIS, | 12 # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 # See the License for the specific language governing permissions and | 14 # See the License for the specific language governing permissions and |
| 15 # limitations under the License. | 15 # limitations under the License. |
| 16 | 16 |
| 17 """Setup installation module for gsutil.""" | 17 """Setup installation module for gsutil.""" |
| 18 | 18 |
| 19 import os | 19 import os |
| 20 from setuptools import setup, find_packages | 20 |
| 21 from setuptools import find_packages |
| 22 from setuptools import setup |
| 21 from setuptools.command import build_py | 23 from setuptools.command import build_py |
| 22 from setuptools.command import sdist | 24 from setuptools.command import sdist |
| 23 | 25 |
| 24 long_desc = """ | 26 long_desc = """ |
| 25 gsutil is a Python application that lets you access Google Cloud Storage from | 27 gsutil is a Python application that lets you access Google Cloud Storage from |
| 26 the command line. You can use gsutil to do a wide range of bucket and object | 28 the command line. You can use gsutil to do a wide range of bucket and object |
| 27 management tasks, including: | 29 management tasks, including: |
| 28 * Creating and deleting buckets. | 30 * Creating and deleting buckets. |
| 29 * Uploading, downloading, and deleting objects. | 31 * Uploading, downloading, and deleting objects. |
| 30 * Listing buckets and objects. | 32 * Listing buckets and objects. |
| 31 * Moving, copying, and renaming objects. | 33 * Moving, copying, and renaming objects. |
| 32 * Editing object and bucket ACLs. | 34 * Editing object and bucket ACLs. |
| 33 """ | 35 """ |
| 34 | 36 |
| 35 requires = [ | 37 requires = [ |
| 36 'boto==2.22.1', | 38 'boto==2.30.0', |
| 39 'crcmod>=1.7', |
| 40 'gcs-oauth2-boto-plugin>=1.8', |
| 41 'google-api-python-client>=1.1', |
| 37 'httplib2>=0.8', | 42 'httplib2>=0.8', |
| 43 'pyOpenSSL>=0.13', |
| 38 'python-gflags>=2.0', | 44 'python-gflags>=2.0', |
| 39 'google-api-python-client>=1.1', | 45 'retry_decorator>=1.0.0', |
| 40 'pyOpenSSL>=0.13', | |
| 41 'crcmod>=1.7', | |
| 42 # Not using 1.02 because of: | 46 # Not using 1.02 because of: |
| 43 # https://code.google.com/p/socksipy-branch/issues/detail?id=3 | 47 # https://code.google.com/p/socksipy-branch/issues/detail?id=3 |
| 44 'SocksiPy-branch==1.01', | 48 'SocksiPy-branch==1.01', |
| 45 'retry_decorator>=1.0.0', | |
| 46 ] | 49 ] |
| 47 | 50 |
| 48 dependency_links = [ | 51 dependency_links = [ |
| 49 # Note: this commit ID should be kept in sync with the 'third_party/boto' | 52 # Note: this commit ID should be kept in sync with the 'third_party/boto' |
| 50 # entry in 'git submodule status'. | 53 # entry in 'git submodule status'. |
| 51 'https://github.com/boto/boto/archive/7cb344c382c3acb95038cf54bf8a84d5242318
b9.tar.gz#egg=boto-2.22.1', | 54 # pylint: disable=line-too-long |
| 55 'https://github.com/boto/boto/archive/34e0dcfaa778ee469ca08ae487a0bd4021a8e0
da.tar.gz#egg=boto-2.30.0', |
| 52 ] | 56 ] |
| 53 | 57 |
| 54 CURDIR = os.path.abspath(os.path.dirname(__file__)) | 58 CURDIR = os.path.abspath(os.path.dirname(__file__)) |
| 55 BOTO_DIR = os.path.join(CURDIR, 'third_party', 'boto') | 59 BOTO_DIR = os.path.join(CURDIR, 'third_party', 'boto') |
| 56 | 60 |
| 57 with open(os.path.join(CURDIR, 'VERSION'), 'r') as f: | 61 with open(os.path.join(CURDIR, 'VERSION'), 'r') as f: |
| 58 VERSION = f.read().strip() | 62 VERSION = f.read().strip() |
| 59 | 63 |
| 60 with open(os.path.join(CURDIR, 'CHECKSUM'), 'r') as f: | 64 with open(os.path.join(CURDIR, 'CHECKSUM'), 'r') as f: |
| 61 CHECKSUM = f.read() | 65 CHECKSUM = f.read() |
| 62 | 66 |
| 63 | 67 |
| 64 def PlaceNeededFiles(self, target_dir): | 68 def PlaceNeededFiles(self, target_dir): |
| 69 """Populates necessary files into the gslib module and unit test modules.""" |
| 65 target_dir = os.path.join(target_dir, 'gslib') | 70 target_dir = os.path.join(target_dir, 'gslib') |
| 66 self.mkpath(target_dir) | 71 self.mkpath(target_dir) |
| 67 | 72 |
| 68 # Copy the gsutil root VERSION file into gslib module. | 73 # Copy the gsutil root VERSION file into gslib module. |
| 69 with open(os.path.join(target_dir, 'VERSION'), 'w') as f: | 74 with open(os.path.join(target_dir, 'VERSION'), 'w') as fp: |
| 70 f.write(VERSION) | 75 fp.write(VERSION) |
| 71 | 76 |
| 72 # Copy the gsutil root CHECKSUM file into gslib module. | 77 # Copy the gsutil root CHECKSUM file into gslib module. |
| 73 with open(os.path.join(target_dir, 'CHECKSUM'), 'w') as f: | 78 with open(os.path.join(target_dir, 'CHECKSUM'), 'w') as fp: |
| 74 f.write(CHECKSUM) | 79 fp.write(CHECKSUM) |
| 75 | 80 |
| 76 # Copy the Boto test module required by gsutil unit tests. | 81 # Copy the Boto test module required by gsutil unit tests. |
| 77 tests_dir = os.path.join(target_dir, 'tests') | 82 tests_dir = os.path.join(target_dir, 'tests') |
| 78 self.mkpath(tests_dir) | 83 self.mkpath(tests_dir) |
| 79 mock_storage_dst = os.path.join(tests_dir, 'mock_storage_service.py') | 84 mock_storage_dst = os.path.join(tests_dir, 'mock_storage_service.py') |
| 80 mock_storage_src1 = os.path.join( | 85 mock_storage_src1 = os.path.join( |
| 81 BOTO_DIR, 'tests', 'integration', 's3', 'mock_storage_service.py') | 86 BOTO_DIR, 'tests', 'integration', 's3', 'mock_storage_service.py') |
| 82 mock_storage_src2 = os.path.join( | 87 mock_storage_src2 = os.path.join( |
| 83 CURDIR, 'gslib', 'tests', 'mock_storage_service.py') | 88 CURDIR, 'gslib', 'tests', 'mock_storage_service.py') |
| 84 mock_storage_src = ( | 89 mock_storage_src = ( |
| 85 mock_storage_src1 | 90 mock_storage_src1 |
| 86 if os.path.isfile(mock_storage_src1) else mock_storage_src2) | 91 if os.path.isfile(mock_storage_src1) else mock_storage_src2) |
| 87 if not os.path.isfile(mock_storage_src): | 92 if not os.path.isfile(mock_storage_src): |
| 88 raise Exception('Unable to find required boto test source file at %s or %s.' | 93 raise Exception('Unable to find required boto test source file at %s or %s.' |
| 89 % (mock_storage_src1, mock_storage_src2)) | 94 % (mock_storage_src1, mock_storage_src2)) |
| 90 with open(mock_storage_src, 'r') as f: | 95 with open(mock_storage_src, 'r') as fp: |
| 91 mock_storage_contents = f.read() | 96 mock_storage_contents = fp.read() |
| 92 with open(mock_storage_dst, 'w') as f: | 97 with open(mock_storage_dst, 'w') as fp: |
| 93 f.write('#\n' | 98 fp.write('#\n' |
| 94 '# This file was copied during gsutil package generation from\n' | 99 '# This file was copied during gsutil package generation from\n' |
| 95 '# the Boto test suite, originally located at:\n' | 100 '# the Boto test suite, originally located at:\n' |
| 96 '# tests/integration/s3/mock_storage_service.py\n' | 101 '# tests/integration/s3/mock_storage_service.py\n' |
| 97 '# DO NOT MODIFY\n' | 102 '# DO NOT MODIFY\n' |
| 98 '#\n\n') | 103 '#\n\n') |
| 99 f.write(mock_storage_contents) | 104 fp.write(mock_storage_contents) |
| 100 | 105 |
| 101 | 106 |
| 102 class CustomBuildPy(build_py.build_py): | 107 class CustomBuildPy(build_py.build_py): |
| 108 """Excludes update command from package-installed versions of gsutil.""" |
| 103 | 109 |
| 104 def byte_compile(self, files): | 110 def byte_compile(self, files): |
| 105 for filename in files: | 111 for filename in files: |
| 106 # Note: we exclude the update command here because binary distributions | 112 # Note: we exclude the update command here because binary distributions |
| 107 # (built via setup.py bdist command) don't abide by the MANIFEST file. | 113 # (built via setup.py bdist command) don't abide by the MANIFEST file. |
| 108 # For source distributions (built via setup.py sdist), the update command | 114 # For source distributions (built via setup.py sdist), the update command |
| 109 # will be excluded by the MANIFEST file. | 115 # will be excluded by the MANIFEST file. |
| 110 if 'gslib/commands/update.py' in filename: | 116 if 'gslib/commands/update.py' in filename: |
| 111 os.unlink(filename) | 117 os.unlink(filename) |
| 112 build_py.build_py.byte_compile(self, files) | 118 build_py.build_py.byte_compile(self, files) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 'gsutil = gslib.__main__:main', | 160 'gsutil = gslib.__main__:main', |
| 155 ], | 161 ], |
| 156 }, | 162 }, |
| 157 install_requires=requires, | 163 install_requires=requires, |
| 158 dependency_links=dependency_links, | 164 dependency_links=dependency_links, |
| 159 cmdclass={ | 165 cmdclass={ |
| 160 'build_py': CustomBuildPy, | 166 'build_py': CustomBuildPy, |
| 161 'sdist': CustomSDist, | 167 'sdist': CustomSDist, |
| 162 } | 168 } |
| 163 ) | 169 ) |
| OLD | NEW |