setup.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3. import os
  4. import re
  5. from setuptools import setup
  6. path = os.path.dirname(__file__)
  7. desc_fd = os.path.join(path, 'README.rst')
  8. hist_fd = os.path.join(path, 'HISTORY.rst')
  9. long_desc = ''
  10. short_desc = 'A Kerberos authentication handler for python-requests'
  11. if os.path.isfile(desc_fd):
  12. with open(desc_fd) as fd:
  13. long_desc = fd.read()
  14. if os.path.isfile(hist_fd):
  15. with open(hist_fd) as fd:
  16. long_desc = '\n\n'.join([long_desc, fd.read()])
  17. def get_version():
  18. """
  19. Simple function to extract the current version using regular expressions.
  20. """
  21. reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
  22. with open('requests_kerberos/__init__.py') as fd:
  23. matches = list(filter(lambda x: x, map(reg.match, fd)))
  24. if not matches:
  25. raise RuntimeError(
  26. 'Could not find the version information for requests_kerberos'
  27. )
  28. return matches[0].group(1)
  29. setup(
  30. name='requests-kerberos',
  31. description=short_desc,
  32. long_description=long_desc,
  33. author='Ian Cordasco, Cory Benfield, Michael Komitee',
  34. author_email='graffatcolmingov@gmail.com',
  35. url='https://github.com/requests/requests-kerberos',
  36. packages=['requests_kerberos'],
  37. package_data={'': ['LICENSE', 'AUTHORS']},
  38. include_package_data=True,
  39. version=get_version(),
  40. install_requires=[
  41. 'requests>=1.1.0',
  42. 'cryptography>=1.3;python_version!="3.3"',
  43. 'cryptography>=1.3,<2;python_version=="3.3"'
  44. ],
  45. extras_require={
  46. ':sys_platform=="win32"': ['winkerberos>=0.5.0'],
  47. ':sys_platform!="win32"': ['pykerberos>=1.1.8,<2.0.0'],
  48. },
  49. test_suite='test_requests_kerberos',
  50. tests_require=['mock'],
  51. )