setup.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env python
  2. from setuptools import setup, find_packages
  3. import os, re
  4. PKG='oauth2'
  5. VERSIONFILE = os.path.join('oauth2', '_version.py')
  6. verstr = "unknown"
  7. try:
  8. verstrline = open(VERSIONFILE, "rt").read()
  9. except EnvironmentError:
  10. pass # Okay, there is no version file.
  11. else:
  12. MVSRE = r"^manual_verstr *= *['\"]([^'\"]*)['\"]"
  13. mo = re.search(MVSRE, verstrline, re.M)
  14. if mo:
  15. mverstr = mo.group(1)
  16. else:
  17. print "unable to find version in %s" % (VERSIONFILE,)
  18. raise RuntimeError("if %s.py exists, it must be well-formed" % (VERSIONFILE,))
  19. AVSRE = r"^auto_build_num *= *['\"]([^'\"]*)['\"]"
  20. mo = re.search(AVSRE, verstrline, re.M)
  21. if mo:
  22. averstr = mo.group(1)
  23. else:
  24. averstr = ''
  25. verstr = '.'.join([mverstr, averstr])
  26. setup(name=PKG,
  27. version=verstr,
  28. description="library for OAuth version 1.0",
  29. author="Joe Stump",
  30. author_email="joe@simplegeo.com",
  31. url="http://github.com/simplegeo/python-oauth2",
  32. packages = find_packages(),
  33. install_requires = ['httplib2'],
  34. license = "MIT License",
  35. keywords="oauth",
  36. zip_safe = True,
  37. test_suite="tests",
  38. tests_require=['coverage', 'mock'])