diff --git a/AUTHORS b/AUTHORS index 7e744e0..b987a9b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -92,3 +92,4 @@ * Brandon T. Willard * Andrew R. M. * Tristan de Cacqueray +* Sören Tempel diff --git a/get_version.py b/get_version.py index 759336d..9224f59 100644 --- a/get_version.py +++ b/get_version.py @@ -5,16 +5,19 @@ import os, subprocess, runpy os.chdir(os.path.split(os.path.abspath(__file__))[0]) VERSIONFILE = os.path.join("hy", "version.py") -try: - __version__ = (subprocess.check_output - (["git", "describe", "--tags", "--dirty"]) - .decode('ASCII').strip() - .replace('-', '+', 1).replace('-', '.')) - with open(VERSIONFILE, "wt") as o: - o.write("__version__ = {!r}\n".format(__version__)) +if "HY_VERSION" in os.environ: + __version__ = os.environ["HY_VERSION"] +else: + try: + __version__ = (subprocess.check_output + (["git", "describe", "--tags", "--dirty"]) + .decode('ASCII').strip() + .replace('-', '+', 1).replace('-', '.')) + with open(VERSIONFILE, "wt") as o: + o.write("__version__ = {!r}\n".format(__version__)) -except (subprocess.CalledProcessError, OSError): - if os.path.exists(VERSIONFILE): - __version__ = runpy.run_path(VERSIONFILE)['__version__'] - else: - __version__ = "unknown" + except (subprocess.CalledProcessError, OSError): + if os.path.exists(VERSIONFILE): + __version__ = runpy.run_path(VERSIONFILE)['__version__'] + else: + __version__ = "unknown"