setup.py 1.5 KB

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