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