setup.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/usr/bin/python
  2. # vim: set fileencoding=utf-8 :
  3. # Copyright (C) 2006-2011 Guido Günther <agx@sigxcpu.org>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, please see
  17. # <http://www.gnu.org/licenses/>
  18. # END OF COPYRIGHT #
  19. import subprocess
  20. from setuptools import setup, find_packages
  21. import os
  22. def fetch_version():
  23. """Get version from debian changelog and write it to gbp/version.py"""
  24. version = "0.0"
  25. try:
  26. popen = subprocess.Popen('dpkg-parsechangelog', stdout=subprocess.PIPE)
  27. out, ret = popen.communicate()
  28. for line in out.decode('utf-8').split('\n'):
  29. if line.startswith('Version:'):
  30. version = line.split(' ')[1].strip()
  31. break
  32. except OSError:
  33. pass # Failing is fine, we just can't print the version then
  34. with open('gbp/version.py', 'w') as f:
  35. f.write('"The current gbp version number"\n')
  36. f.write('gbp_version="%s"\n' % version)
  37. return version
  38. def readme():
  39. with open('README') as file:
  40. return file.read()
  41. setup(name = "gbp",
  42. version = fetch_version(),
  43. author = u'Guido Günther',
  44. author_email = 'agx@sigxcpu.org',
  45. url = 'https://honk.sigxcpu.org/piki/projects/git-buildpackage/',
  46. description = 'Suite to help with Debian packages in Git repositories',
  47. license = 'GPLv2+',
  48. long_description = readme(),
  49. classifiers = [
  50. 'Environment :: Console',
  51. 'Programming Language :: Python :: 2',
  52. 'Topic :: Software Development :: Version Control :: Git',
  53. 'Operating System :: POSIX :: Linux',
  54. ],
  55. scripts = ['bin/git-pbuilder',
  56. 'bin/gbp-builder-mock'],
  57. packages = find_packages(exclude=['tests', 'tests.*']),
  58. data_files = [("/etc/git-buildpackage/", ["gbp.conf"]),],
  59. requires = ["six"],
  60. setup_requires=['nose>=0.11.1', 'coverage>=2.85', 'nosexcover>=1.0.7'] if \
  61. os.getenv('WITHOUT_NOSETESTS') is None else [],
  62. entry_points = {
  63. 'console_scripts': [ 'gbp = gbp.scripts.supercommand:supercommand' ],
  64. },
  65. )