setup.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/env python
  2. """
  3. Setup script
  4. """
  5. # Required to build on EL6
  6. __requires__ = ['SQLAlchemy >= 0.8', 'jinja2 >= 2.4']
  7. import pkg_resources
  8. import os
  9. import re
  10. from setuptools import setup
  11. pagurefile = os.path.join(os.path.dirname(__file__), 'pagure', '__init__.py')
  12. # Thanks to SQLAlchemy:
  13. # https://github.com/zzzeek/sqlalchemy/blob/master/setup.py#L104
  14. with open(pagurefile) as stream:
  15. __version__ = re.compile(
  16. r".*__version__ = '(.*?)'", re.S
  17. ).match(stream.read()).group(1)
  18. def get_requirements(requirements_file='requirements.txt'):
  19. """Get the contents of a file listing the requirements.
  20. :arg requirements_file: path to a requirements file
  21. :type requirements_file: string
  22. :returns: the list of requirements, or an empty list if
  23. `requirements_file` could not be opened or read
  24. :return type: list
  25. """
  26. lines = open(requirements_file).readlines()
  27. return [
  28. line.rstrip().split('#')[0]
  29. for line in lines
  30. if not line.startswith('#')
  31. ]
  32. setup(
  33. name='pagure',
  34. description='A light-weight git-centered forge based on pygit2..',
  35. version=__version__,
  36. author='Pierre-Yves Chibon',
  37. author_email='pingou@pingoured.fr',
  38. maintainer='Pierre-Yves Chibon',
  39. maintainer_email='pingou@pingoured.fr',
  40. license='GPLv2+',
  41. download_url='https://fedorahosted.org/releases/p/r/pagure/',
  42. url='https://fedorahosted.org/pagure/',
  43. packages=['pagure'],
  44. include_package_data=True,
  45. install_requires=get_requirements(),
  46. )