1import os 2import setuptools 3import setuptools.command.test 4import sys 5 6pkgdir = {"": "python%s" % sys.version_info[0]} 7VERSION = "0.18.1" 8 9 10# `python setup.py test` uses existing Python environment, no virtualenv, no pip. 11# Use case: Archlinux package. https://github.com/httplib2/httplib2/issues/103 12# Otherwise, use `script/test` 13class TestCommand(setuptools.command.test.test): 14 def run_tests(self): 15 # pytest may be not installed yet 16 import pytest 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 25def 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 33setuptools.setup( 34 name="httplib2", 35 version=VERSION, 36 author="Joe Gregorio", 37 author_email="joe@bitworking.org", 38 url="https://github.com/httplib2/httplib2", 39 description="A comprehensive HTTP client library.", 40 license="MIT", 41 long_description=""" 42 43A 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 package_dir=pkgdir, 86 packages=["httplib2"], 87 package_data={"httplib2": ["*.txt"]}, 88 tests_require=read_requirements("requirements-test.txt"), 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 :: 2", 98 "Programming Language :: Python :: 2.7", 99 "Programming Language :: Python :: 3", 100 "Programming Language :: Python :: 3.4", 101 "Programming Language :: Python :: 3.5", 102 "Programming Language :: Python :: 3.6", 103 "Programming Language :: Python :: 3.7", 104 "Topic :: Internet :: WWW/HTTP", 105 "Topic :: Software Development :: Libraries", 106 ], 107) 108