setup.py
This file
Path
setup.py
101 lines · 3.1 KiB · Python
Last changed by
Merge pull request #4114 from cyberjacob/masterCory Benfieldbefore adoption5697148
History of this fileTake it
1#!/usr/bin/env python23import os4import re5import sys67from codecs import open89from setuptools import setup10from setuptools.command.test import test as TestCommand1112here = os.path.abspath(os.path.dirname(__file__))1314class PyTest(TestCommand):15 user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]1617 def initialize_options(self):18 TestCommand.initialize_options(self)19 try:20 from multiprocessing import cpu_count21 self.pytest_args = ['-n', str(cpu_count()), '--boxed']22 except (ImportError, NotImplementedError):23 self.pytest_args = ['-n', '1', '--boxed']2425 def finalize_options(self):26 TestCommand.finalize_options(self)27 self.test_args = []28 self.test_suite = True2930 def run_tests(self):31 import pytest3233 errno = pytest.main(self.pytest_args)34 sys.exit(errno)3536# 'setup.py publish' shortcut.37if sys.argv[-1] == 'publish':38 os.system('python setup.py sdist bdist_wheel')39 os.system('twine upload dist/*')40 sys.exit()4142packages = ['requests']4344requires = [45 'chardet>=3.0.2,<3.1.0',46 'idna>=2.5,<2.6',47 'urllib3>=1.21.1,<1.22',48 'certifi>=2017.4.17'4950]51test_requirements = ['pytest-httpbin==0.0.7', 'pytest-cov', 'pytest-mock', 'pytest-xdist', 'PySocks>=1.5.6, !=1.5.7', 'pytest>=2.8.0']5253about = {}54with open(os.path.join(here, 'requests', '__version__.py'), 'r', 'utf-8') as f:55 exec(f.read(), about)5657with open('README.rst', 'r', 'utf-8') as f:58 readme = f.read()59with open('HISTORY.rst', 'r', 'utf-8') as f:60 history = f.read()6162setup(63 name=about['__title__'],64 version=about['__version__'],65 description=about['__description__'],66 long_description=readme + '\n\n' + history,67 author=about['__author__'],68 author_email=about['__author_email__'],69 url=about['__url__'],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=about['__license__'],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 :: 3.6',90 'Programming Language :: Python :: Implementation :: CPython',91 'Programming Language :: Python :: Implementation :: PyPy'92 ),93 cmdclass={'test': PyTest},94 tests_require=test_requirements,95 extras_require={96 'security': ['pyOpenSSL>=0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'],97 'socks': ['PySocks>=1.5.6, !=1.5.7'],98 'socks:sys_platform == "win32" and (python_version == "2.7" or python_version == "2.6")': ['win_inet_pton'],99 },100)101