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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 Makefile                  |    3 ++-
 setup.py                  |   15 ++++++++++++++-
 src/pylorax/buildstamp.py |   10 ++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 66b1b00..f1a2f84 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 e026651..5b710f0 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"]))
 
+# 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 97f0477..0c06ce5 100644
--- a/src/pylorax/buildstamp.py
+++ b/src/pylorax/buildstamp.py
@@ -41,6 +41,14 @@ class BuildStamp(object):
         self.uuid = "{0}.{1}".format(now, buildarch)
 
     def write(self):
+        # get lorax version
+        try:
+            import pylorax.version
+        except ImportError:
+            vernum = "devel"
+        else:
+            vernum = pylorax.version.num
+
         logger.info("writing .buildstamp file")
         with open(self.path, "w") as fobj:
             fobj.write("[Main]\n")
@@ -49,3 +57,5 @@ class BuildStamp(object):
             fobj.write("BugURL={0.bugurl}\n".format(self))
             fobj.write("IsFinal={0.isfinal}\n".format(self))
             fobj.write("UUID={0.uuid}\n".format(self))
+            fobj.write("[Compose]\n")
+            fobj.write("Lorax={0}\n".format(vernum))
-- 
1.7.3.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux