| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 import os | |
| 4 import re | |
| 5 import sys | |
| 6 | |
| 7 from codecs import open | |
| 8 | |
| 9 from setuptools import setup | |
| 10 from setuptools.command.test import test as TestCommand | |
| 11 | |
| 12 | |
| 13 class PyTest(TestCommand): | |
| 14 user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")] | |
| 15 | |
| 16 def initialize_options(self): | |
| 17 TestCommand.initialize_options(self) | |
| 18 self.pytest_args = [] | |
| 19 | |
| 20 def finalize_options(self): | |
| 21 TestCommand.finalize_options(self) | |
| 22 self.test_args = [] | |
| 23 self.test_suite = True | |
| 24 | |
| 25 def run_tests(self): | |
| 26 import pytest | |
| 27 | |
| 28 errno = pytest.main(self.pytest_args) | |
| 29 sys.exit(errno) | |
| 30 | |
| 31 | |
| 32 if sys.argv[-1] == 'publish': | |
| 33 os.system('python setup.py sdist upload') | |
| 34 sys.exit() | |
| 35 | |
| 36 packages = [ | |
| 37 'requests', | |
| 38 'requests.packages', | |
| 39 'requests.packages.chardet', | |
| 40 'requests.packages.urllib3', | |
| 41 'requests.packages.urllib3.packages', | |
| 42 'requests.packages.urllib3.contrib', | |
| 43 'requests.packages.urllib3.util', | |
| 44 'requests.packages.urllib3.packages.ssl_match_hostname', | |
| 45 ] | |
| 46 | |
| 47 requires = [] | |
| 48 test_requirements = ['pytest>=2.8.0', 'pytest-httpbin==0.0.7', 'pytest-cov'] | |
| 49 | |
| 50 with open('requests/__init__.py', 'r') as fd: | |
| 51 version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', | |
| 52 fd.read(), re.MULTILINE).group(1) | |
| 53 | |
| 54 if not version: | |
| 55 raise RuntimeError('Cannot find version information') | |
| 56 | |
| 57 with open('README.rst', 'r', 'utf-8') as f: | |
| 58 readme = f.read() | |
| 59 with open('HISTORY.rst', 'r', 'utf-8') as f: | |
| 60 history = f.read() | |
| 61 | |
| 62 setup( | |
| 63 name='requests', | |
| 64 version=version, | |
| 65 description='Python HTTP for Humans.', | |
| 66 long_description=readme + '\n\n' + history, | |
| 67 author='Kenneth Reitz', | |
| 68 author_email='me@kennethreitz.com', | |
| 69 url='http://python-requests.org', | |
| 70 packages=packages, | |
| 71 package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']}, | |
| 72 package_dir={'requests': 'requests'}, | |
| 73 include_package_data=True, | |
| 74 install_requires=requires, | |
| 75 license='Apache 2.0', | |
| 76 zip_safe=False, | |
| 77 classifiers=( | |
| 78 'Development Status :: 5 - Production/Stable', | |
| 79 'Intended Audience :: Developers', | |
| 80 'Natural Language :: English', | |
| 81 'License :: OSI Approved :: Apache Software License', | |
| 82 'Programming Language :: Python', | |
| 83 'Programming Language :: Python :: 2.6', | |
| 84 'Programming Language :: Python :: 2.7', | |
| 85 'Programming Language :: Python :: 3', | |
| 86 'Programming Language :: Python :: 3.3', | |
| 87 'Programming Language :: Python :: 3.4', | |
| 88 'Programming Language :: Python :: 3.5', | |
| 89 'Programming Language :: Python :: Implementation :: CPython', | |
| 90 'Programming Language :: Python :: Implementation :: PyPy' | |
| 91 ), | |
| 92 cmdclass={'test': PyTest}, | |
| 93 tests_require=test_requirements, | |
| 94 extras_require={ | |
| 95 'security': ['pyOpenSSL>=0.13', 'ndg-httpsclient', 'pyasn1'], | |
| 96 'socks': ['PySocks>=1.5.6'], | |
| 97 }, | |
| 98 ) | |
| OLD | NEW |