Skip to content
Myr

setup.py

This file

Path

setup.py

109 lines · 3.5 KiB · Python

Last changed by

Merge pull request #4672 from requests/remove_2.6_refsNate Prewittbefore adoptiond1aeb7e

History of this file

Take it

1#!/usr/bin/env python2# Learn more: https://github.com/kennethreitz/setup.py34import os5import re6import sys78from codecs import open910from setuptools import setup11from setuptools.command.test import test as TestCommand1213here = os.path.abspath(os.path.dirname(__file__))1415class PyTest(TestCommand):16    user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]1718    def initialize_options(self):19        TestCommand.initialize_options(self)20        try:21            from multiprocessing import cpu_count22            self.pytest_args = ['-n', str(cpu_count()), '--boxed']23        except (ImportError, NotImplementedError):24            self.pytest_args = ['-n', '1', '--boxed']2526    def finalize_options(self):27        TestCommand.finalize_options(self)28        self.test_args = []29        self.test_suite = True3031    def run_tests(self):32        import pytest3334        errno = pytest.main(self.pytest_args)35        sys.exit(errno)3637# 'setup.py publish' shortcut.38if sys.argv[-1] == 'publish':39    os.system('python setup.py sdist bdist_wheel')40    os.system('twine upload dist/*')41    sys.exit()4243# pyOpenSSL version 18.0.0 dropped support for Python 2.644if sys.version_info < (2, 7):45    PYOPENSSL_VERSION = 'pyOpenSSL >= 0.14, < 18.0.0'46else:47    PYOPENSSL_VERSION = 'pyOpenSSL >= 0.14'4849packages = ['requests']5051requires = [52    'chardet>=3.0.2,<3.1.0',53    'idna>=2.5,<2.7',54    'urllib3>=1.21.1,<1.24',55    'certifi>=2017.4.17'5657]58test_requirements = ['pytest-httpbin==0.0.7', 'pytest-cov', 'pytest-mock', 'pytest-xdist', 'PySocks>=1.5.6, !=1.5.7', 'pytest>=2.8.0']5960about = {}61with open(os.path.join(here, 'requests', '__version__.py'), 'r', 'utf-8') as f:62    exec(f.read(), about)6364with open('README.rst', 'r', 'utf-8') as f:65    readme = f.read()66with open('HISTORY.rst', 'r', 'utf-8') as f:67    history = f.read()6869setup(70    name=about['__title__'],71    version=about['__version__'],72    description=about['__description__'],73    long_description=readme + '\n\n' + history,74    long_description_content_type='text/x-rst',75    author=about['__author__'],76    author_email=about['__author_email__'],77    url=about['__url__'],78    packages=packages,79    package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},80    package_dir={'requests': 'requests'},81    include_package_data=True,82    python_requires=">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",83    install_requires=requires,84    license=about['__license__'],85    zip_safe=False,86    classifiers=(87        'Development Status :: 5 - Production/Stable',88        'Intended Audience :: Developers',89        'Natural Language :: English',90        'License :: OSI Approved :: Apache Software License',91        'Programming Language :: Python',92        'Programming Language :: Python :: 2',93        'Programming Language :: Python :: 2.6',94        'Programming Language :: Python :: 2.7',95        'Programming Language :: Python :: 3',96        'Programming Language :: Python :: 3.4',97        'Programming Language :: Python :: 3.5',98        'Programming Language :: Python :: 3.6',99        'Programming Language :: Python :: Implementation :: CPython',100        'Programming Language :: Python :: Implementation :: PyPy'101    ),102    cmdclass={'test': PyTest},103    tests_require=test_requirements,104    extras_require={105        'security': [PYOPENSSL_VERSION, 'cryptography>=1.3.4', 'idna>=2.0.0'],106        'socks': ['PySocks>=1.5.6, !=1.5.7'],107        'socks:sys_platform == "win32" and (python_version == "2.7" or python_version == "2.6")': ['win_inet_pton'],108    },109)