Write the lorax verion in the .buildstamp (#689697)

(cherry picked from commit 4271e0fc02)

Conflicts:
	src/pylorax/buildstamp.py

Signed-off-by: Will Woods <wwoods@redhat.com>
This commit is contained in:
Martin Gracik 2011-07-29 14:08:03 +02:00 committed by Will Woods
parent 0236440581
commit 73fc20b165
3 changed files with 24 additions and 3 deletions

View File

@ -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)

View File

@ -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",

View File

@ -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")