setup.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/usr/bin/env python
  2. import os
  3. import re
  4. import sys
  5. from codecs import open
  6. try:
  7. from setuptools import setup
  8. except ImportError:
  9. from distutils.core import setup
  10. if sys.argv[-1] == 'publish':
  11. os.system('python setup.py sdist upload')
  12. sys.exit()
  13. packages = [
  14. 'requests',
  15. 'requests.packages',
  16. 'requests.packages.chardet',
  17. 'requests.packages.urllib3',
  18. 'requests.packages.urllib3.packages',
  19. 'requests.packages.urllib3.contrib',
  20. 'requests.packages.urllib3.util',
  21. 'requests.packages.urllib3.packages.ssl_match_hostname',
  22. ]
  23. requires = []
  24. version = ''
  25. with open('requests/__init__.py', 'r') as fd:
  26. version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
  27. fd.read(), re.MULTILINE).group(1)
  28. if not version:
  29. raise RuntimeError('Cannot find version information')
  30. with open('README.rst', 'r', 'utf-8') as f:
  31. readme = f.read()
  32. with open('HISTORY.rst', 'r', 'utf-8') as f:
  33. history = f.read()
  34. setup(
  35. name='requests',
  36. version=version,
  37. description='Python HTTP for Humans.',
  38. long_description=readme + '\n\n' + history,
  39. author='Kenneth Reitz',
  40. author_email='me@kennethreitz.com',
  41. url='http://python-requests.org',
  42. packages=packages,
  43. package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},
  44. package_dir={'requests': 'requests'},
  45. include_package_data=True,
  46. install_requires=requires,
  47. license='Apache 2.0',
  48. zip_safe=False,
  49. classifiers=(
  50. 'Development Status :: 5 - Production/Stable',
  51. 'Intended Audience :: Developers',
  52. 'Natural Language :: English',
  53. 'License :: OSI Approved :: Apache Software License',
  54. 'Programming Language :: Python',
  55. 'Programming Language :: Python :: 2.7',
  56. 'Programming Language :: Python :: 3',
  57. 'Programming Language :: Python :: 3.3',
  58. 'Programming Language :: Python :: 3.4',
  59. 'Programming Language :: Python :: 3.5',
  60. ),
  61. extras_require={
  62. 'security': ['pyOpenSSL>=0.13', 'ndg-httpsclient', 'pyasn1'],
  63. },
  64. )