diff options
author | Guido Günther <agx@sigxcpu.org> | 2011-11-07 16:05:20 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2011-11-07 17:35:45 +0100 |
commit | 1b15dc848f312005258c5a9bf762448acf5d9f8b (patch) | |
tree | b2ed0852fab058a5184151d4dec79587c5df35e6 /setup.py | |
parent | 962a9937d5cf912bdbbb0f8ee14e80197a75fd5c (diff) | |
download | git-buildpackage-1b15dc848f312005258c5a9bf762448acf5d9f8b.tar.gz git-buildpackage-1b15dc848f312005258c5a9bf762448acf5d9f8b.tar.bz2 git-buildpackage-1b15dc848f312005258c5a9bf762448acf5d9f8b.zip |
Move gbp/version.py generation into setup.py
This allows us to build on non Debian systems with setup.py only.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -17,9 +17,32 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # END OF COPYRIGHT # +import subprocess from setuptools import setup + +def fetch_version(): + """Get version from debian changelog and write it to gbp/version.py""" + version = "0.0" + + try: + popen = subprocess.Popen('dpkg-parsechangelog', stdout=subprocess.PIPE) + out, ret = popen.communicate() + for line in out.split('\n'): + if line.startswith('Version:'): + version = line.split(' ')[1].strip() + break + except OSError: + pass # Failing is fine, we just can't print the version then + + with file('gbp/version.py', 'w') as f: + f.write('gbp_version="%s"\n' % version) + + return version + + setup(name = "gbp", + version = fetch_version(), author = u'Guido Günther', author_email = 'agx@sigxcpu.org', scripts = [ 'bin/git-buildpackage', |