setup.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/usr/bin/env python
  2. # This file is protected via CODEOWNERS
  3. import codecs
  4. import os
  5. import re
  6. from setuptools import setup
  7. base_path = os.path.dirname(__file__)
  8. # Get the version (borrowed from SQLAlchemy)
  9. with open(os.path.join(base_path, "src", "urllib3", "_version.py")) as fp:
  10. VERSION = (
  11. re.compile(r""".*__version__ = ["'](.*?)['"]""", re.S).match(fp.read()).group(1)
  12. )
  13. with codecs.open("README.rst", encoding="utf-8") as fp:
  14. # Remove reST raw directive from README as they're not allowed on PyPI
  15. # Those blocks start with a newline and continue until the next newline
  16. mode = None
  17. lines = []
  18. for line in fp:
  19. if line.startswith(".. raw::"):
  20. mode = "ignore_nl"
  21. elif line == "\n":
  22. mode = "wait_nl" if mode == "ignore_nl" else None
  23. if mode is None:
  24. lines.append(line)
  25. readme = "".join(lines)
  26. with codecs.open("CHANGES.rst", encoding="utf-8") as fp:
  27. changes = fp.read()
  28. version = VERSION
  29. setup(
  30. name="urllib3",
  31. version=version,
  32. description="HTTP library with thread-safe connection pooling, file post, and more.",
  33. long_description=u"\n\n".join([readme, changes]),
  34. long_description_content_type="text/x-rst",
  35. classifiers=[
  36. "Environment :: Web Environment",
  37. "Intended Audience :: Developers",
  38. "License :: OSI Approved :: MIT License",
  39. "Operating System :: OS Independent",
  40. "Programming Language :: Python",
  41. "Programming Language :: Python :: 2",
  42. "Programming Language :: Python :: 2.7",
  43. "Programming Language :: Python :: 3",
  44. "Programming Language :: Python :: 3.6",
  45. "Programming Language :: Python :: 3.7",
  46. "Programming Language :: Python :: 3.8",
  47. "Programming Language :: Python :: 3.9",
  48. "Programming Language :: Python :: 3.10",
  49. "Programming Language :: Python :: 3.11",
  50. "Programming Language :: Python :: Implementation :: CPython",
  51. "Programming Language :: Python :: Implementation :: PyPy",
  52. "Topic :: Internet :: WWW/HTTP",
  53. "Topic :: Software Development :: Libraries",
  54. ],
  55. keywords="urllib httplib threadsafe filepost http https ssl pooling",
  56. author="Andrey Petrov",
  57. author_email="andrey.petrov@shazow.net",
  58. url="https://urllib3.readthedocs.io/",
  59. project_urls={
  60. "Documentation": "https://urllib3.readthedocs.io/",
  61. "Code": "https://github.com/urllib3/urllib3",
  62. "Issue tracker": "https://github.com/urllib3/urllib3/issues",
  63. },
  64. license="MIT",
  65. packages=[
  66. "urllib3",
  67. "urllib3.packages",
  68. "urllib3.packages.backports",
  69. "urllib3.contrib",
  70. "urllib3.contrib._securetransport",
  71. "urllib3.util",
  72. ],
  73. package_dir={"": "src"},
  74. requires=[],
  75. python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4",
  76. extras_require={
  77. "brotli": [
  78. "brotli>=1.0.9; (os_name != 'nt' or python_version >= '3') and platform_python_implementation == 'CPython'",
  79. "brotlicffi>=0.8.0; (os_name != 'nt' or python_version >= '3') and platform_python_implementation != 'CPython'",
  80. "brotlipy>=0.6.0; os_name == 'nt' and python_version < '3'",
  81. ],
  82. "secure": [
  83. "pyOpenSSL>=0.14",
  84. "cryptography>=1.3.4",
  85. "idna>=2.0.0",
  86. "certifi",
  87. "ipaddress; python_version=='2.7'",
  88. "urllib3-secure-extra",
  89. ],
  90. "socks": ["PySocks>=1.5.6,<2.0,!=1.5.7"],
  91. },
  92. )