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