Permalink
Browse files

Added Git describe to the version output.

  • Loading branch information...
1 parent 5a5a03b commit 3770ddf7ad59e984e1c10428f036f0ca06a2f5fb @ereOn ereOn committed May 6, 2014
Showing with 14 additions and 2 deletions.
  1. +2 −2 defines.hpp.template
  2. +12 −0 defines.py
@@ -9,10 +9,10 @@
#define FREELAN_VERSION_MAJOR {defines.version.major}
#define FREELAN_VERSION_MINOR {defines.version.minor}
#define FREELAN_VERSION_PATCH {defines.version.patch}
+#define FREELAN_REPOSITORY_VERSION "{defines.repository_version}"
#define FREELAN_DATE "{defines.date}"
-#define FREELAN_VERSION (FREELAN_VERSION_MAJOR * 0x01000000L + FREELAN_VERSION_MINOR * 0x00010000L)
-#define FREELAN_VERSION_STRING TO_STRING(FREELAN_VERSION_MAJOR) "." TO_STRING(FREELAN_VERSION_MINOR)
+#define FREELAN_VERSION_STRING TO_STRING(FREELAN_VERSION_MAJOR) "." TO_STRING(FREELAN_VERSION_MINOR) "." TO_STRING(FREELAN_VERSION_PATCH) " (" FREELAN_REPOSITORY_VERSION ")"
#define FREELAN_NAME_VERSION_MAJOR FREELAN_NAME TO_STRING(FREELAN_VERSION_MAJOR)
#define FREELAN_USER_AGENT FREELAN_NAME_VERSION_MAJOR "/" FREELAN_VERSION_STRING
View
@@ -19,6 +19,7 @@ class Defines(object):
def __init__(self):
self._repository_root = None
+ self._repository_version = None
self._version = None
self._date = None
@@ -33,6 +34,16 @@ def repository_root(self):
return self._repository_root
@property
+ def repository_version(self):
+ if self._repository_version is None:
+ try:
+ self._repository_version = check_output(['git', 'describe', '--dirty=-modified']).rstrip()
+ except CalledProcessError, OSError:
+ self._repository_version = "<unspecified version>"
+
+ return self._repository_version
+
+ @property
def version_file_path(self):
return os.path.join(self.repository_root, 'VERSION')
@@ -72,6 +83,7 @@ def emitter(self, target, source, env):
Modifies the dependencies.
"""
+ env.Depends(target, env.Value(self.repository_version))
env.Depends(target, env.Value(self.version))
env.Depends(target, env.Value(self.date))

0 comments on commit 3770ddf

Please sign in to comment.