Merge pull request #1821 from nmeum/prefer-version-file
get_version.py: Prefer VERSIONFILE over git-describe(1)
This commit is contained in:
commit
32a734cedc
1
AUTHORS
1
AUTHORS
@ -92,3 +92,4 @@
|
|||||||
* Brandon T. Willard <brandonwillard@gmail.com>
|
* Brandon T. Willard <brandonwillard@gmail.com>
|
||||||
* Andrew R. M. <nixy@nixy.moe>
|
* Andrew R. M. <nixy@nixy.moe>
|
||||||
* Tristan de Cacqueray <tdecacqu@redhat.com>
|
* Tristan de Cacqueray <tdecacqu@redhat.com>
|
||||||
|
* Sören Tempel <soeren@soeren-tempel.net>
|
||||||
|
@ -5,7 +5,10 @@ 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")
|
||||||
|
|
||||||
try:
|
if "HY_VERSION" in os.environ:
|
||||||
|
__version__ = os.environ["HY_VERSION"]
|
||||||
|
else:
|
||||||
|
try:
|
||||||
__version__ = (subprocess.check_output
|
__version__ = (subprocess.check_output
|
||||||
(["git", "describe", "--tags", "--dirty"])
|
(["git", "describe", "--tags", "--dirty"])
|
||||||
.decode('ASCII').strip()
|
.decode('ASCII').strip()
|
||||||
@ -13,7 +16,7 @@ try:
|
|||||||
with open(VERSIONFILE, "wt") as o:
|
with open(VERSIONFILE, "wt") as o:
|
||||||
o.write("__version__ = {!r}\n".format(__version__))
|
o.write("__version__ = {!r}\n".format(__version__))
|
||||||
|
|
||||||
except (subprocess.CalledProcessError, OSError):
|
except (subprocess.CalledProcessError, OSError):
|
||||||
if os.path.exists(VERSIONFILE):
|
if os.path.exists(VERSIONFILE):
|
||||||
__version__ = runpy.run_path(VERSIONFILE)['__version__']
|
__version__ = runpy.run_path(VERSIONFILE)['__version__']
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user