Skip to content
Myr

setup.py

This file

Path

setup.py

98 lines · 3.0 KiB · Python

Last changed by

number of cores for travisKenneth Reitzbefore adoptione6e3589

History of this file

Take it

1#!/usr/bin/env python23import os4import re5import sys67from codecs import open89from setuptools import setup10from setuptools.command.test import test as TestCommand11from multiprocessing import cpu_count1213here = 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        self.pytest_args = ['-n', str(cpu_count()), '--boxed']2122    def finalize_options(self):23        TestCommand.finalize_options(self)24        self.test_args = []25        self.test_suite = True2627    def run_tests(self):28        import pytest2930        errno = pytest.main(self.pytest_args)31        sys.exit(errno)3233# 'setup.py publish' shortcut.34if sys.argv[-1] == 'publish':35    os.system('python setup.py sdist bdist_wheel')36    os.system('twine upload dist/*')37    sys.exit()3839packages = ['requests']4041requires = [42    'chardet>=3.0.2,<3.1.0',43    'idna>=2.5,<2.6',44    'urllib3>=1.21.1,<1.22',45    'certifi>=2017.4.17'4647]48test_requirements = ['pytest-httpbin==0.0.7', 'pytest-cov', 'pytest-mock', 'pytest-xdist', 'PySocks>=1.5.6, !=1.5.7', 'pytest>=2.8.0']4950about = {}51with open(os.path.join(here, 'requests', '__version__.py'), 'r', 'utf-8') as f:52    exec(f.read(), about)5354with open('README.rst', 'r', 'utf-8') as f:55    readme = f.read()56with open('HISTORY.rst', 'r', 'utf-8') as f:57    history = f.read()5859setup(60    name=about['__title__'],61    version=about['__version__'],62    description=about['__description__'],63    long_description=readme + '\n\n' + history,64    author=about['__author__'],65    author_email=about['__author_email__'],66    url=about['__url__'],67    packages=packages,68    package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},69    package_dir={'requests': 'requests'},70    include_package_data=True,71    install_requires=requires,72    license=about['__license__'],73    zip_safe=False,74    classifiers=(75        'Development Status :: 5 - Production/Stable',76        'Intended Audience :: Developers',77        'Natural Language :: English',78        'License :: OSI Approved :: Apache Software License',79        'Programming Language :: Python',80        'Programming Language :: Python :: 2.6',81        'Programming Language :: Python :: 2.7',82        'Programming Language :: Python :: 3',83        'Programming Language :: Python :: 3.3',84        'Programming Language :: Python :: 3.4',85        'Programming Language :: Python :: 3.5',86        'Programming Language :: Python :: 3.6',87        'Programming Language :: Python :: Implementation :: CPython',88        'Programming Language :: Python :: Implementation :: PyPy'89    ),90    cmdclass={'test': PyTest},91    tests_require=test_requirements,92    extras_require={93        'security': ['pyOpenSSL>=0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'],94        'socks': ['PySocks>=1.5.6, !=1.5.7'],95        'socks:sys_platform == "win32" and (python_version == "2.7" or python_version == "2.6")': ['win_inet_pton'],96    },97)98