diff --git a/requests/__about__.py b/requests/__about__.py new file mode 100644 index 00000000..9abded42 --- /dev/null +++ b/requests/__about__.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +# .-. .-. .-. . . .-. .-. .-. .-. +# |( |- |.| | | |- `-. | `-. +# ' ' `-' `-`.`-' `-' `-' ' `-' + +__title__ = 'requests' +__description__ = 'Python HTTP for Humans.' +__url__ = 'http://python-requests.org' +__version__ = '2.14.2' +__build__ = 0x021402 +__author__ = 'Kenneth Reitz' +__author_email__ = 'me@kennethreitz.org' +__license__ = 'Apache 2.0' +__copyright__ = 'Copyright 2017 Kenneth Reitz' +__cake__ = u'✨ 🍰 ✨ Thanks for using my software. It means the world to me. --kennethreitz' \ No newline at end of file diff --git a/requests/__init__.py b/requests/__init__.py index 7f6c480f..4d3055c8 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -40,13 +40,7 @@ is at . :license: Apache 2.0, see LICENSE for more details. """ -__title__ = 'requests' -__version__ = '2.14.2' -__build__ = 0x021402 -__author__ = 'Kenneth Reitz' -__license__ = 'Apache 2.0' -__copyright__ = 'Copyright 2017 Kenneth Reitz' -__cake__ = u'✨ 🍰 ✨ Thanks for using my software. It means the world to me. --kennethreitz' +from .__about__ import * # Attempt to enable urllib3's SNI support, if possible try: diff --git a/setup.py b/setup.py index b9588ebd..fd8a1716 100755 --- a/setup.py +++ b/setup.py @@ -9,6 +9,7 @@ from codecs import open from setuptools import setup from setuptools.command.test import test as TestCommand +here = os.path.abspath(os.path.dirname(__file__)) class PyTest(TestCommand): user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")] @@ -28,7 +29,7 @@ class PyTest(TestCommand): errno = pytest.main(self.pytest_args) sys.exit(errno) - +# 'setup.py publish' shortcut. if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') sys.exit() @@ -51,12 +52,9 @@ packages = [ requires = [] test_requirements = ['pytest>=2.8.0', 'pytest-httpbin==0.0.7', 'pytest-cov', 'pytest-mock'] -with open('requests/__init__.py', 'r', 'utf-8') as fd: - version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', - fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError('Cannot find version information') +about = {} +with open(os.path.join(here, 'requests', '__about__.py')) as f: + exec(f.read(), about) with open('README.rst', 'r', 'utf-8') as f: readme = f.read() @@ -64,19 +62,19 @@ with open('HISTORY.rst', 'r', 'utf-8') as f: history = f.read() setup( - name='requests', - version=version, - description='Python HTTP for Humans.', + name=about['__title__'], + version=about['__version__'], + description=about['__description__'], long_description=readme + '\n\n' + history, - author='Kenneth Reitz', - author_email='me@kennethreitz.com', - url='http://python-requests.org', + author=about['__author__'], + author_email=about['__author_email__'], + url=about['__url__'], packages=packages, package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']}, package_dir={'requests': 'requests'}, include_package_data=True, install_requires=requires, - license='Apache 2.0', + license=about['__license__'], zip_safe=False, classifiers=( 'Development Status :: 5 - Production/Stable',