mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-25 20:25:28 +03:00
49 lines
1.8 KiB
Diff
49 lines
1.8 KiB
Diff
From 5e06a5b38d9a3026589ea11cc4c64bddd9a88ef3 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
|
Date: Sun, 17 May 2020 16:48:13 +0200
|
|
Subject: [PATCH] get_version.py: Also write VERSIONFILE when HY_VERSION env is
|
|
set
|
|
|
|
Without this change, hy is not capable of figuring out the correct
|
|
version in the REPL if the version was set using the HY_VERSION
|
|
environment variable during build.
|
|
---
|
|
get_version.py | 23 ++++++++++++-----------
|
|
1 file changed, 12 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/get_version.py b/get_version.py
|
|
index 9224f59..c6af6db 100644
|
|
--- a/get_version.py
|
|
+++ b/get_version.py
|
|
@@ -5,19 +5,20 @@ import os, subprocess, runpy
|
|
os.chdir(os.path.split(os.path.abspath(__file__))[0])
|
|
VERSIONFILE = os.path.join("hy", "version.py")
|
|
|
|
-if "HY_VERSION" in os.environ:
|
|
- __version__ = os.environ["HY_VERSION"]
|
|
-else:
|
|
- try:
|
|
+try:
|
|
+ if "HY_VERSION" in os.environ:
|
|
+ __version__ = os.environ["HY_VERSION"]
|
|
+ else:
|
|
__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"
|
|
+ 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"
|