Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improve version printing when run from a checkout

  • Loading branch information...
commit f1e8bfb8a766035d2556066b5522c6a51a3df9d1 1 parent c1e1e7b
@evax authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 lib/cdist/__init__.py
View
14 lib/cdist/__init__.py
@@ -19,7 +19,17 @@
#
#
-VERSION = "2.0.9"
+import os
+import subprocess
+
+try:
+ with open(os.devnull, 'w') as devnull:
+ here = os.path.dirname(os.path.realpath(__file__))
+ VERSION = subprocess.check_output(
+ 'cd "%s" && git describe' % here,
+ stderr=devnull, shell=True).decode('utf-8')
+except:
+ VERSION = "2.0.9"
BANNER = """
.. . .x+=:. s
@@ -38,8 +48,6 @@
DOT_CDIST = ".cdist"
-import os
-
class Error(Exception):
"""Base exception class for this project"""
pass
Please sign in to comment.
Something went wrong with that request. Please try again.