2011-02-13 13:52:37 -05:00
|
|
|
#!/usr/bin/env python
|
2012-05-02 19:18:14 -04:00
|
|
|
import os
|
2011-02-13 13:52:37 -05:00
|
|
|
import sys
|
2014-09-03 09:40:27 +02:00
|
|
|
from codecs import open
|
|
|
|
|
|
2016-01-20 07:51:42 -06:00
|
|
|
from setuptools import setup
|
2016-02-02 12:02:37 +01:00
|
|
|
from setuptools.command.test import test as TestCommand
|
|
|
|
|
|
2022-03-25 10:50:33 -06:00
|
|
|
CURRENT_PYTHON = sys.version_info[:2]
|
2024-02-20 15:22:20 -08:00
|
|
|
REQUIRED_PYTHON = (3, 8)
|
2022-03-25 10:50:33 -06:00
|
|
|
|
|
|
|
|
if CURRENT_PYTHON < REQUIRED_PYTHON:
|
|
|
|
|
sys.stderr.write(
|
|
|
|
|
"""
|
|
|
|
|
==========================
|
|
|
|
|
Unsupported Python version
|
|
|
|
|
==========================
|
|
|
|
|
This version of Requests requires at least Python {}.{}, but
|
|
|
|
|
you're trying to install it on Python {}.{}. To resolve this,
|
|
|
|
|
consider upgrading to a supported Python version.
|
|
|
|
|
|
|
|
|
|
If you can't upgrade your Python version, you'll need to
|
2024-02-20 15:22:20 -08:00
|
|
|
pin to an older version of Requests (<2.32.0).
|
2022-03-25 10:50:33 -06:00
|
|
|
""".format(
|
|
|
|
|
*(REQUIRED_PYTHON + CURRENT_PYTHON)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
sys.exit(1)
|
2016-02-02 12:02:37 +01:00
|
|
|
|
2022-04-29 13:16:58 -06:00
|
|
|
|
2016-02-02 12:02:37 +01:00
|
|
|
class PyTest(TestCommand):
|
|
|
|
|
user_options = [("pytest-args=", "a", "Arguments to pass into py.test")]
|
|
|
|
|
|
|
|
|
|
def initialize_options(self):
|
|
|
|
|
TestCommand.initialize_options(self)
|
2017-05-30 11:01:34 +01:00
|
|
|
try:
|
|
|
|
|
from multiprocessing import cpu_count
|
2022-04-29 13:16:58 -06:00
|
|
|
|
2017-05-30 11:01:34 +01:00
|
|
|
self.pytest_args = ["-n", str(cpu_count()), "--boxed"]
|
|
|
|
|
except (ImportError, NotImplementedError):
|
|
|
|
|
self.pytest_args = ["-n", "1", "--boxed"]
|
2016-02-02 12:02:37 +01:00
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
|
TestCommand.finalize_options(self)
|
|
|
|
|
self.test_args = []
|
|
|
|
|
self.test_suite = True
|
|
|
|
|
|
|
|
|
|
def run_tests(self):
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
errno = pytest.main(self.pytest_args)
|
|
|
|
|
sys.exit(errno)
|
2016-01-20 07:51:42 -06:00
|
|
|
|
2022-04-29 13:16:58 -06:00
|
|
|
|
2017-05-25 11:31:38 -04:00
|
|
|
# 'setup.py publish' shortcut.
|
2011-12-11 11:39:57 -05:00
|
|
|
if sys.argv[-1] == "publish":
|
2017-05-26 21:43:03 -04:00
|
|
|
os.system("python setup.py sdist bdist_wheel")
|
|
|
|
|
os.system("twine upload dist/*")
|
2011-02-17 16:22:03 -05:00
|
|
|
sys.exit()
|
2011-02-13 13:52:37 -05:00
|
|
|
|
2017-05-26 22:44:56 -04:00
|
|
|
requires = [
|
2022-10-20 18:26:18 +00:00
|
|
|
"charset_normalizer>=2,<4",
|
2022-03-25 10:50:33 -06:00
|
|
|
"idna>=2.5,<4",
|
2023-05-03 08:39:44 -07:00
|
|
|
"urllib3>=1.21.1,<3",
|
2022-03-25 10:50:33 -06:00
|
|
|
"certifi>=2017.4.17",
|
2017-05-26 22:44:56 -04:00
|
|
|
]
|
2018-09-15 13:26:59 +03:00
|
|
|
test_requirements = [
|
2023-05-13 15:10:56 +01:00
|
|
|
"pytest-httpbin==2.0.0",
|
2018-09-15 13:26:59 +03:00
|
|
|
"pytest-cov",
|
|
|
|
|
"pytest-mock",
|
|
|
|
|
"pytest-xdist",
|
|
|
|
|
"PySocks>=1.5.6, !=1.5.7",
|
2022-03-25 10:50:33 -06:00
|
|
|
"pytest>=3",
|
2018-09-15 13:26:59 +03:00
|
|
|
]
|
2012-05-01 19:34:07 -07:00
|
|
|
|
2017-05-25 11:31:38 -04:00
|
|
|
about = {}
|
2022-03-25 10:50:33 -06:00
|
|
|
here = os.path.abspath(os.path.dirname(__file__))
|
2023-08-13 14:46:13 -07:00
|
|
|
with open(os.path.join(here, "src", "requests", "__version__.py"), "r", "utf-8") as f:
|
2017-05-25 11:31:38 -04:00
|
|
|
exec(f.read(), about)
|
2015-03-13 21:47:29 -05:00
|
|
|
|
2018-09-17 06:05:03 -04:00
|
|
|
with open("README.md", "r", "utf-8") as f:
|
2013-10-26 16:43:08 -07:00
|
|
|
readme = f.read()
|
|
|
|
|
|
2011-02-13 13:52:37 -05:00
|
|
|
setup(
|
2017-05-25 11:46:12 -04:00
|
|
|
name=about["__title__"],
|
2017-05-25 11:31:38 -04:00
|
|
|
version=about["__version__"],
|
2017-05-25 11:46:12 -04:00
|
|
|
description=about["__description__"],
|
2018-09-17 06:05:03 -04:00
|
|
|
long_description=readme,
|
|
|
|
|
long_description_content_type="text/markdown",
|
2017-05-25 11:46:12 -04:00
|
|
|
author=about["__author__"],
|
|
|
|
|
author_email=about["__author_email__"],
|
|
|
|
|
url=about["__url__"],
|
2022-03-25 10:50:33 -06:00
|
|
|
packages=["requests"],
|
2020-11-10 12:34:35 -08:00
|
|
|
package_data={"": ["LICENSE", "NOTICE"]},
|
2023-08-13 14:46:13 -07:00
|
|
|
package_dir={"": "src"},
|
2011-12-11 11:39:57 -05:00
|
|
|
include_package_data=True,
|
2024-02-20 15:22:20 -08:00
|
|
|
python_requires=">=3.8",
|
2012-05-01 19:34:07 -07:00
|
|
|
install_requires=requires,
|
2017-05-25 11:46:12 -04:00
|
|
|
license=about["__license__"],
|
2012-10-30 15:20:08 +00:00
|
|
|
zip_safe=False,
|
2018-08-06 23:04:50 -07:00
|
|
|
classifiers=[
|
2011-02-19 01:02:01 -05:00
|
|
|
"Development Status :: 5 - Production/Stable",
|
2021-12-29 15:29:09 -07:00
|
|
|
"Environment :: Web Environment",
|
2011-02-17 16:22:03 -05:00
|
|
|
"Intended Audience :: Developers",
|
2012-12-05 16:19:14 -06:00
|
|
|
"License :: OSI Approved :: Apache Software License",
|
2021-12-29 15:29:09 -07:00
|
|
|
"Natural Language :: English",
|
|
|
|
|
"Operating System :: OS Independent",
|
2011-02-17 16:22:03 -05:00
|
|
|
"Programming Language :: Python",
|
2012-01-23 02:28:01 -05:00
|
|
|
"Programming Language :: Python :: 3",
|
2019-08-20 01:01:06 -04:00
|
|
|
"Programming Language :: Python :: 3.8",
|
2020-11-10 12:34:35 -08:00
|
|
|
"Programming Language :: Python :: 3.9",
|
2021-09-03 19:03:15 -07:00
|
|
|
"Programming Language :: Python :: 3.10",
|
2022-03-25 10:50:33 -06:00
|
|
|
"Programming Language :: Python :: 3.11",
|
2023-08-13 12:56:18 -07:00
|
|
|
"Programming Language :: Python :: 3.12",
|
2022-03-25 10:50:33 -06:00
|
|
|
"Programming Language :: Python :: 3 :: Only",
|
2016-02-02 12:02:37 +01:00
|
|
|
"Programming Language :: Python :: Implementation :: CPython",
|
2021-12-29 15:29:09 -07:00
|
|
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
|
|
|
"Topic :: Internet :: WWW/HTTP",
|
|
|
|
|
"Topic :: Software Development :: Libraries",
|
2018-08-06 23:04:50 -07:00
|
|
|
],
|
2016-02-02 12:02:37 +01:00
|
|
|
cmdclass={"test": PyTest},
|
|
|
|
|
tests_require=test_requirements,
|
2014-08-29 16:39:22 -05:00
|
|
|
extras_require={
|
2021-07-09 11:51:07 -07:00
|
|
|
"security": [],
|
2016-09-05 18:28:57 +02:00
|
|
|
"socks": ["PySocks>=1.5.6, !=1.5.7"],
|
2022-06-28 10:25:58 +08:00
|
|
|
"use_chardet_on_py3": ["chardet>=3.0.2,<6"],
|
2014-08-29 16:39:22 -05:00
|
|
|
},
|
2019-02-23 13:24:52 +00:00
|
|
|
project_urls={
|
2019-10-25 04:02:55 +01:00
|
|
|
"Documentation": "https://requests.readthedocs.io",
|
2019-09-19 07:52:28 -07:00
|
|
|
"Source": "https://github.com/psf/requests",
|
2019-02-23 13:24:52 +00:00
|
|
|
},
|
2011-02-13 13:52:37 -05:00
|
|
|
)
|