setup.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import os
  2. import setuptools
  3. import setuptools.command.test
  4. import sys
  5. pkgdir = {"": "python%s" % sys.version_info[0]}
  6. VERSION = "0.20.4"
  7. # `python setup.py test` uses existing Python environment, no virtualenv, no pip.
  8. # Use case: Archlinux package. https://github.com/httplib2/httplib2/issues/103
  9. # Otherwise, use `script/test`
  10. class TestCommand(setuptools.command.test.test):
  11. def run_tests(self):
  12. # pytest may be not installed yet
  13. import pytest
  14. args = ["--forked", "--fulltrace", "--no-cov", "tests/"]
  15. if self.test_suite:
  16. args += ["-k", self.test_suite]
  17. sys.stderr.write("setup.py:test run pytest {}\n".format(" ".join(args)))
  18. errno = pytest.main(args)
  19. sys.exit(errno)
  20. def read_requirements(name):
  21. project_root = os.path.dirname(os.path.abspath(__file__))
  22. with open(os.path.join(project_root, name), "rb") as f:
  23. # remove whitespace and comments
  24. g = (line.decode("utf-8").lstrip().split("#", 1)[0].rstrip() for line in f)
  25. return [l for l in g if l]
  26. setuptools.setup(
  27. name="httplib2",
  28. version=VERSION,
  29. author="Joe Gregorio",
  30. author_email="joe@bitworking.org",
  31. url="https://github.com/httplib2/httplib2",
  32. description="A comprehensive HTTP client library.",
  33. license="MIT",
  34. long_description="""
  35. A comprehensive HTTP client library, ``httplib2`` supports many features left out of other HTTP libraries.
  36. **HTTP and HTTPS**
  37. HTTPS support is only available if the socket module was compiled with SSL support.
  38. **Keep-Alive**
  39. Supports HTTP 1.1 Keep-Alive, keeping the socket open and performing multiple requests over the same connection if possible.
  40. **Authentication**
  41. The following three types of HTTP Authentication are supported. These can be used over both HTTP and HTTPS.
  42. * Digest
  43. * Basic
  44. * WSSE
  45. **Caching**
  46. The module can optionally operate with a private cache that understands the Cache-Control:
  47. header and uses both the ETag and Last-Modified cache validators. Both file system
  48. and memcached based caches are supported.
  49. **All Methods**
  50. The module can handle any HTTP request method, not just GET and POST.
  51. **Redirects**
  52. Automatically follows 3XX redirects on GETs.
  53. **Compression**
  54. Handles both 'deflate' and 'gzip' types of compression.
  55. **Lost update support**
  56. Automatically adds back ETags into PUT requests to resources we have already cached. This implements Section 3.2 of Detecting the Lost Update Problem Using Unreserved Checkout
  57. **Unit Tested**
  58. A large and growing set of unit tests.
  59. """,
  60. package_dir=pkgdir,
  61. packages=["httplib2"],
  62. package_data={"httplib2": ["*.txt"]},
  63. install_requires=read_requirements("requirements.txt"),
  64. tests_require=read_requirements("requirements-test.txt"),
  65. python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
  66. cmdclass={"test": TestCommand},
  67. classifiers=[
  68. "Development Status :: 4 - Beta",
  69. "Environment :: Web Environment",
  70. "Intended Audience :: Developers",
  71. "License :: OSI Approved :: MIT License",
  72. "Operating System :: OS Independent",
  73. "Programming Language :: Python",
  74. "Programming Language :: Python :: 2",
  75. "Programming Language :: Python :: 2.7",
  76. "Programming Language :: Python :: 3",
  77. "Programming Language :: Python :: 3.4",
  78. "Programming Language :: Python :: 3.5",
  79. "Programming Language :: Python :: 3.6",
  80. "Programming Language :: Python :: 3.7",
  81. "Programming Language :: Python :: 3.8",
  82. "Programming Language :: Python :: 3.9",
  83. "Topic :: Internet :: WWW/HTTP",
  84. "Topic :: Software Development :: Libraries",
  85. ],
  86. )