From 73fc20b1651bf70ba0da991feafec911510fdff5 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Fri, 29 Jul 2011 14:08:03 +0200 Subject: [PATCH] Write the lorax verion in the .buildstamp (#689697) (cherry picked from commit 4271e0fc02eb3553f1056756a9035c285a2dd09f) Conflicts: src/pylorax/buildstamp.py Signed-off-by: Will Woods --- Makefile | 3 ++- setup.py | 15 ++++++++++++++- src/pylorax/buildstamp.py | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 66b1b00f..f1a2f840 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ all: $(PYTHON) setup.py build install: all + @echo "num = '$(VERSION)-$(RELEASE)'" > src/pylorax/version.py $(PYTHON) setup.py install --root=$(DESTDIR) clean: @@ -28,7 +29,7 @@ archive: tag local: @rm -rf $(PKGNAME)-$(VERSION).tar.bz2 - @rm -rf /tmp/$(PKGNAME)-$(VERSION) /tmp/$(PKGNAME) + @rm -rf /tmp/$(PKGNAME)-$(VERSION) @dir=$$PWD; cp -a $$dir /tmp/$(PKGNAME)-$(VERSION) @rm -rf /tmp/$(PKGNAME)-$(VERSION)/.git @dir=$$PWD; cd /tmp; tar --bzip2 -cSpf $$dir/$(PKGNAME)-$(VERSION).tar.bz2 $(PKGNAME)-$(VERSION) diff --git a/setup.py b/setup.py index 892fb95c..8eadf8bd 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ from distutils.core import setup from glob import glob import os +import sys # config file @@ -17,8 +18,20 @@ for root, dnames, fnames in os.walk("share"): # executable data_files.append(("/usr/sbin", ["src/sbin/lorax", "src/sbin/mkefiboot"])) +# get the version +sys.path.insert(0, "src") +try: + import pylorax.version +except ImportError: + vernum = "devel" +else: + vernum = pylorax.version.num +finally: + sys.path = sys.path[1:] + + setup(name="lorax", - version="0.1", + version=vernum, description="Lorax", long_description="", author="Martin Gracik", diff --git a/src/pylorax/buildstamp.py b/src/pylorax/buildstamp.py index 378c7ea0..6953a6c1 100644 --- a/src/pylorax/buildstamp.py +++ b/src/pylorax/buildstamp.py @@ -38,7 +38,14 @@ class BuildStamp(object): self.uuid = "{0}.{1}".format(now, buildarch) def write(self, outfile): - vernum = "treebuilder" # XXX TODO FIXME + # get lorax version + try: + import pylorax.version + except ImportError: + vernum = "devel" + else: + vernum = pylorax.version.num + logger.info("writing .buildstamp file") with open(outfile, "w") as fobj: fobj.write("[Main]\n")