get_version.py: allow specifying version in environment variable
While packaging hy for Alpine Linux I noticed that the VERSIONFILE is ignored if hy is build in a git repository. On Alpine the packages are build in the package repository resulting in a wrong hy version. This change allows specifying the version in an environment variable which is preferred over git-describe(1) and the VERSIONFILE.
This commit is contained in:
parent
84d1a116f6
commit
31041f1713
@ -5,6 +5,9 @@ import os, subprocess, runpy
|
|||||||
os.chdir(os.path.split(os.path.abspath(__file__))[0])
|
os.chdir(os.path.split(os.path.abspath(__file__))[0])
|
||||||
VERSIONFILE = os.path.join("hy", "version.py")
|
VERSIONFILE = os.path.join("hy", "version.py")
|
||||||
|
|
||||||
|
if "HY_VERSION" in os.environ:
|
||||||
|
__version__ = os.environ["HY_VERSION"]
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
__version__ = (subprocess.check_output
|
__version__ = (subprocess.check_output
|
||||||
(["git", "describe", "--tags", "--dirty"])
|
(["git", "describe", "--tags", "--dirty"])
|
||||||
|
Loading…
Reference in New Issue
Block a user