Skip to content

Commit d5ffe11

Browse files
author
Jon Wayne Parrott
authored
Normalize all setup.py files (#4909)
1 parent ead25e4 commit d5ffe11

File tree

1 file changed

+59
-44
lines changed

1 file changed

+59
-44
lines changed
Lines changed: 59 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2016 Google LLC
1+
# Copyright 2018 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,63 +12,78 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import io
1516
import os
1617

17-
from setuptools import find_packages
18-
from setuptools import setup
18+
import setuptools
1919

2020

21-
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
21+
# Package metadata.
2222

23-
with open(os.path.join(PACKAGE_ROOT, 'README.rst')) as file_obj:
24-
README = file_obj.read()
23+
name = 'google-cloud-core'
24+
description = 'Google Cloud API client core library'
25+
version = '0.28.1.dev1'
26+
# Should be one of:
27+
# 'Development Status :: 3 - Alpha'
28+
# 'Development Status :: 4 - Beta'
29+
# 'Development Status :: 5 - Stable'
30+
release_status = 'Development Status :: 4 - Beta'
31+
dependencies = [
32+
'google-api-core<0.2.0dev,>=0.1.1',
33+
]
34+
extras = {
35+
'grpc': 'grpcio>=1.8.2',
36+
}
37+
38+
39+
# Setup boilerplate below this line.
40+
41+
package_root = os.path.abspath(os.path.dirname(__file__))
2542

26-
# NOTE: This is duplicated throughout and we should try to
27-
# consolidate.
28-
SETUP_BASE = {
29-
'author': 'Google Cloud Platform',
30-
'author_email': 'googleapis-publisher@google.com',
31-
'scripts': [],
32-
'url': 'https://github.com/GoogleCloudPlatform/google-cloud-python',
33-
'license': 'Apache 2.0',
34-
'platforms': 'Posix; MacOS X; Windows',
35-
'include_package_data': True,
36-
'zip_safe': False,
37-
'classifiers': [
38-
'Development Status :: 4 - Beta',
43+
readme_filename = os.path.join(package_root, 'README.rst')
44+
with io.open(readme_filename, encoding='utf-8') as readme_file:
45+
readme = readme_file.read()
46+
47+
# Only include packages under the 'google' namespace. Do not include tests,
48+
# benchmarks, etc.
49+
packages = [
50+
package for package in setuptools.find_packages()
51+
if package.startswith('google')]
52+
53+
# Determine which namespaces are needed.
54+
namespaces = ['google']
55+
if 'google.cloud' in packages:
56+
namespaces.append('google.cloud')
57+
58+
59+
setuptools.setup(
60+
name=name,
61+
version=version,
62+
description=description,
63+
long_description=readme,
64+
author='Google LLC',
65+
author_email='googleapis-packages@google.com',
66+
license='Apache 2.0',
67+
url='https://github.com/GoogleCloudPlatform/google-cloud-python',
68+
classifiers=[
69+
release_status,
3970
'Intended Audience :: Developers',
4071
'License :: OSI Approved :: Apache Software License',
41-
'Operating System :: OS Independent',
72+
'Programming Language :: Python',
4273
'Programming Language :: Python :: 2',
4374
'Programming Language :: Python :: 2.7',
4475
'Programming Language :: Python :: 3',
4576
'Programming Language :: Python :: 3.4',
4677
'Programming Language :: Python :: 3.5',
4778
'Programming Language :: Python :: 3.6',
79+
'Operating System :: OS Independent',
4880
'Topic :: Internet',
4981
],
50-
}
51-
52-
53-
REQUIREMENTS = [
54-
'google-api-core >= 0.1.1, < 0.2.0dev',
55-
]
56-
57-
EXTRAS_REQUIREMENTS = {
58-
'grpc': ['grpcio >= 1.8.2'],
59-
}
60-
61-
setup(
62-
name='google-cloud-core',
63-
version='0.28.1.dev1',
64-
description='API Client library for Google Cloud: Core Helpers',
65-
long_description=README,
66-
namespace_packages=[
67-
'google',
68-
'google.cloud',
69-
],
70-
packages=find_packages(exclude=('tests*',)),
71-
install_requires=REQUIREMENTS,
72-
extras_require=EXTRAS_REQUIREMENTS,
73-
**SETUP_BASE
82+
platforms='Posix; MacOS X; Windows',
83+
packages=packages,
84+
namespace_packages=namespaces,
85+
install_requires=dependencies,
86+
extras_require=extras,
87+
include_package_data=True,
88+
zip_safe=False,
7489
)

0 commit comments

Comments
 (0)