setup.py
This file
Path
setup.py
108 lines · 3.5 KiB · Python
Last changed by
represent classifiers as list instead of tupleNate Prewittbefore adoption489f58c
History of this fileTake it
1#!/usr/bin/env python2# Learn more: https://github.com/kennethreitz/setup.py3import 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()4142# pyOpenSSL version 18.0.0 dropped support for Python 2.643if sys.version_info < (2, 7):44 PYOPENSSL_VERSION = 'pyOpenSSL >= 0.14, < 18.0.0'45else:46 PYOPENSSL_VERSION = 'pyOpenSSL >= 0.14'4748packages = ['requests']4950requires = [51 'chardet>=3.0.2,<3.1.0',52 'idna>=2.5,<2.8',53 'urllib3>=1.21.1,<1.24',54 'certifi>=2017.4.17'5556]57test_requirements = ['pytest-httpbin==0.0.7', 'pytest-cov', 'pytest-mock', 'pytest-xdist', 'PySocks>=1.5.6, !=1.5.7', 'pytest>=2.8.0']5859about = {}60with open(os.path.join(here, 'requests', '__version__.py'), 'r', 'utf-8') as f:61 exec(f.read(), about)6263with open('README.rst', 'r', 'utf-8') as f:64 readme = f.read()65with open('HISTORY.rst', 'r', 'utf-8') as f:66 history = f.read()6768setup(69 name=about['__title__'],70 version=about['__version__'],71 description=about['__description__'],72 long_description=readme + '\n\n' + history,73 long_description_content_type='text/x-rst',74 author=about['__author__'],75 author_email=about['__author_email__'],76 url=about['__url__'],77 packages=packages,78 package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},79 package_dir={'requests': 'requests'},80 include_package_data=True,81 python_requires=">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",82 install_requires=requires,83 license=about['__license__'],84 zip_safe=False,85 classifiers=[86 'Development Status :: 5 - Production/Stable',87 'Intended Audience :: Developers',88 'Natural Language :: English',89 'License :: OSI Approved :: Apache Software License',90 'Programming Language :: Python',91 'Programming Language :: Python :: 2',92 'Programming Language :: Python :: 2.7',93 'Programming Language :: Python :: 3',94 'Programming Language :: Python :: 3.4',95 'Programming Language :: Python :: 3.5',96 'Programming Language :: Python :: 3.6',97 'Programming Language :: Python :: 3.7',98 'Programming Language :: Python :: Implementation :: CPython',99 'Programming Language :: Python :: Implementation :: PyPy'100 ],101 cmdclass={'test': PyTest},102 tests_require=test_requirements,103 extras_require={104 'security': [PYOPENSSL_VERSION, 'cryptography>=1.3.4', 'idna>=2.0.0'],105 'socks': ['PySocks>=1.5.6, !=1.5.7'],106 'socks:sys_platform == "win32" and (python_version == "2.7" or python_version == "2.6")': ['win_inet_pton'],107 },108)