|
1 | | -#!/usr/bin/env python |
2 | | -import os |
3 | 1 | import sys |
4 | | -from codecs import open |
5 | 2 |
|
6 | | -from setuptools import setup |
7 | | - |
8 | | -CURRENT_PYTHON = sys.version_info[:2] |
9 | | -REQUIRED_PYTHON = (3, 9) |
10 | | - |
11 | | -if CURRENT_PYTHON < REQUIRED_PYTHON: |
12 | | - sys.stderr.write( |
13 | | - """ |
14 | | -========================== |
15 | | -Unsupported Python version |
16 | | -========================== |
17 | | -This version of Requests requires at least Python {}.{}, but |
18 | | -you're trying to install it on Python {}.{}. To resolve this, |
19 | | -consider upgrading to a supported Python version. |
20 | | -
|
21 | | -If you can't upgrade your Python version, you'll need to |
22 | | -pin to an older version of Requests (<2.32.0). |
23 | | -""".format(*(REQUIRED_PYTHON + CURRENT_PYTHON)) |
24 | | - ) |
| 3 | +if sys.version_info < (3, 9): |
| 4 | + sys.stderr.write("Requests requires Python 3.9 or later.\n") |
25 | 5 | sys.exit(1) |
26 | 6 |
|
| 7 | +from setuptools import setup |
27 | 8 |
|
28 | | -# 'setup.py publish' shortcut. |
29 | | -if sys.argv[-1] == "publish": |
30 | | - os.system("python setup.py sdist bdist_wheel") |
31 | | - os.system("twine upload dist/*") |
32 | | - sys.exit() |
33 | | - |
34 | | -requires = [ |
35 | | - "charset_normalizer>=2,<4", |
36 | | - "idna>=2.5,<4", |
37 | | - "urllib3>=1.21.1,<3", |
38 | | - "certifi>=2017.4.17", |
39 | | -] |
40 | | -test_requirements = [ |
41 | | - "pytest-httpbin==2.1.0", |
42 | | - "pytest-cov", |
43 | | - "pytest-mock", |
44 | | - "pytest-xdist", |
45 | | - "PySocks>=1.5.6, !=1.5.7", |
46 | | - "pytest>=3", |
47 | | -] |
48 | | - |
49 | | -about = {} |
50 | | -here = os.path.abspath(os.path.dirname(__file__)) |
51 | | -with open(os.path.join(here, "src", "requests", "__version__.py"), "r", "utf-8") as f: |
52 | | - exec(f.read(), about) |
53 | | - |
54 | | -with open("README.md", "r", "utf-8") as f: |
55 | | - readme = f.read() |
56 | | - |
57 | | -setup( |
58 | | - name=about["__title__"], |
59 | | - version=about["__version__"], |
60 | | - description=about["__description__"], |
61 | | - long_description=readme, |
62 | | - long_description_content_type="text/markdown", |
63 | | - author=about["__author__"], |
64 | | - author_email=about["__author_email__"], |
65 | | - url=about["__url__"], |
66 | | - packages=["requests"], |
67 | | - package_data={"": ["LICENSE", "NOTICE"]}, |
68 | | - package_dir={"": "src"}, |
69 | | - include_package_data=True, |
70 | | - python_requires=">=3.9", |
71 | | - install_requires=requires, |
72 | | - license=about["__license__"], |
73 | | - zip_safe=False, |
74 | | - classifiers=[ |
75 | | - "Development Status :: 5 - Production/Stable", |
76 | | - "Environment :: Web Environment", |
77 | | - "Intended Audience :: Developers", |
78 | | - "License :: OSI Approved :: Apache Software License", |
79 | | - "Natural Language :: English", |
80 | | - "Operating System :: OS Independent", |
81 | | - "Programming Language :: Python", |
82 | | - "Programming Language :: Python :: 3", |
83 | | - "Programming Language :: Python :: 3.9", |
84 | | - "Programming Language :: Python :: 3.10", |
85 | | - "Programming Language :: Python :: 3.11", |
86 | | - "Programming Language :: Python :: 3.12", |
87 | | - "Programming Language :: Python :: 3.13", |
88 | | - "Programming Language :: Python :: 3.14", |
89 | | - "Programming Language :: Python :: 3 :: Only", |
90 | | - "Programming Language :: Python :: Implementation :: CPython", |
91 | | - "Programming Language :: Python :: Implementation :: PyPy", |
92 | | - "Topic :: Internet :: WWW/HTTP", |
93 | | - "Topic :: Software Development :: Libraries", |
94 | | - ], |
95 | | - tests_require=test_requirements, |
96 | | - extras_require={ |
97 | | - "security": [], |
98 | | - "socks": ["PySocks>=1.5.6, !=1.5.7"], |
99 | | - "use_chardet_on_py3": ["chardet>=3.0.2,<6"], |
100 | | - }, |
101 | | - project_urls={ |
102 | | - "Documentation": "https://requests.readthedocs.io", |
103 | | - "Source": "https://github.com/psf/requests", |
104 | | - }, |
105 | | -) |
| 9 | +setup() |
0 commit comments