setup.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 GSSAPI 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_gssapi/__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_gssapi'
  27. )
  28. return matches[0].group(1)
  29. setup(
  30. name='requests-gssapi',
  31. description=short_desc,
  32. long_description=long_desc,
  33. author='Ian Cordasco, Cory Benfield, Michael Komitee, Robbie Harwood',
  34. author_email='rharwood@redhat.com',
  35. url='https://github.com/pythongssapi/requests-gssapi',
  36. packages=['requests_gssapi'],
  37. package_data={'': ['LICENSE', 'AUTHORS']},
  38. include_package_data=True,
  39. version=get_version(),
  40. install_requires=[
  41. 'requests>=1.1.0',
  42. 'gssapi',
  43. ],
  44. test_suite='test_requests_gssapi',
  45. tests_require=['mock'],
  46. classifiers=[
  47. "License :: OSI Approved :: ISC License (ISCL)"
  48. ],
  49. )