Add hook in setup.py to update version string.
authorOlof-Joachim Frahm <olof@macrolet.net>
Sun, 18 Jan 2015 14:54:48 +0000 (14:54 +0000)
committerOlof-Joachim Frahm <olof@macrolet.net>
Wed, 21 Jan 2015 20:17:16 +0000 (20:17 +0000)
setup.py

index ad33947..26d908e 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -2,9 +2,11 @@
 
 import sys
 
+from distutils.command.build import build
 from distutils.core import setup
 from setuptools import find_packages
 from setuptools.command.test import test as TestCommand
+from subprocess import call
 
 
 class PyTest (TestCommand):
@@ -25,9 +27,22 @@ class PyTest (TestCommand):
         sys.exit (pytest.main (self.pytest_args))
 
 
+class UpdateVersion (build):
+    def run (self):
+        build.run (self)
+
+        def compile ():
+            call (["make", "build/crypto-install"])
+
+        self.execute (compile, [], "Updating version")
+
+
 setup (name = "crypto_install",
        version = "0.0.1",
        scripts = ["crypto-install"],
        install_requires = [],
        tests_require = ["pytest"],
-       cmdclass = {"test": PyTest})
+       cmdclass = {
+           "test": PyTest,
+           "build": UpdateVersion
+       })