Skip to content
Myr

setup.py

This file

Path

setup.py

103 lines · 3.2 KiB · Python

Last changed by

take a page out of @sigmavirus42's bookKenneth Reitzbefore adoption7abfd92

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 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        self.pytest_args = []2021    def finalize_options(self):22        TestCommand.finalize_options(self)23        self.test_args = []24        self.test_suite = True2526    def run_tests(self):27        import pytest2829        errno = pytest.main(self.pytest_args)30        sys.exit(errno)3132# 'setup.py publish' shortcut.33if sys.argv[-1] == 'publish':34    os.system('python setup.py sdist upload')35    sys.exit()3637packages = [38    'requests',39    'requests.packages',40    'requests.packages.chardet',41    'requests.packages.chardet.cli',42    'requests.packages.idna',43    'requests.packages.urllib3',44    'requests.packages.urllib3.packages',45    'requests.packages.urllib3.contrib',46    'requests.packages.urllib3.util',47    'requests.packages.urllib3.packages.ssl_match_hostname',48    'requests.packages.urllib3.packages.backports',49    'requests.packages.urllib3.contrib._securetransport',50]5152requires = []53test_requirements = ['pytest>=2.8.0', 'pytest-httpbin==0.0.7', 'pytest-cov', 'pytest-mock']5455about = {}56with open(os.path.join(here, 'requests', '__version__.py')) as f:57    exec(f.read(), about)5859with open('README.rst', 'r', 'utf-8') as f:60    readme = f.read()61with open('HISTORY.rst', 'r', 'utf-8') as f:62    history = f.read()6364setup(65    name=about['__title__'],66    version=about['__version__'],67    description=about['__description__'],68    long_description=readme + '\n\n' + history,69    author=about['__author__'],70    author_email=about['__author_email__'],71    url=about['__url__'],72    packages=packages,73    package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},74    package_dir={'requests': 'requests'},75    include_package_data=True,76    install_requires=requires,77    license=about['__license__'],78    zip_safe=False,79    classifiers=(80        'Development Status :: 5 - Production/Stable',81        'Intended Audience :: Developers',82        'Natural Language :: English',83        'License :: OSI Approved :: Apache Software License',84        'Programming Language :: Python',85        'Programming Language :: Python :: 2.6',86        'Programming Language :: Python :: 2.7',87        'Programming Language :: Python :: 3',88        'Programming Language :: Python :: 3.3',89        'Programming Language :: Python :: 3.4',90        'Programming Language :: Python :: 3.5',91        'Programming Language :: Python :: 3.6',92        'Programming Language :: Python :: Implementation :: CPython',93        'Programming Language :: Python :: Implementation :: PyPy'94    ),95    cmdclass={'test': PyTest},96    tests_require=test_requirements,97    extras_require={98        'security': ['pyOpenSSL>=0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'],99        'socks': ['PySocks>=1.5.6, !=1.5.7'],100        'socks:sys_platform == "win32" and (python_version == "2.7" or python_version == "2.6")': ['win_inet_pton'],101    },102)103