diff --git a/testing/hy/0001-get_version.py-Also-write-VERSIONFILE-when-HY_VERSIO.patch b/testing/hy/0001-get_version.py-Also-write-VERSIONFILE-when-HY_VERSIO.patch new file mode 100644 index 00000000000..9bb2f40223e --- /dev/null +++ b/testing/hy/0001-get_version.py-Also-write-VERSIONFILE-when-HY_VERSIO.patch @@ -0,0 +1,49 @@ +From 5e06a5b38d9a3026589ea11cc4c64bddd9a88ef3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +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" diff --git a/testing/hy/APKBUILD b/testing/hy/APKBUILD index 471c8573216..4f917c49cbc 100644 --- a/testing/hy/APKBUILD +++ b/testing/hy/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Sören Tempel pkgname=hy pkgver=0.18.0 -pkgrel=2 +pkgrel=3 pkgdesc="Dialect of Lisp that's embedded in Python" url="http://hylang.org/" arch="noarch" @@ -11,7 +11,8 @@ depends="python3 py3-funcparserlib py3-astor py3-rply py3-colorama" makedepends="py3-setuptools py3-sphinx py3-sphinx_rtd_theme" checkdepends="python3-tests py3-pytest py3-pytest-runner py3-tox" subpackages="$pkgname-doc" -source="$pkgname-$pkgver.tar.gz::https://github.com/hylang/hy/archive/$pkgver.tar.gz" +source="$pkgname-$pkgver.tar.gz::https://github.com/hylang/hy/archive/$pkgver.tar.gz + 0001-get_version.py-Also-write-VERSIONFILE-when-HY_VERSIO.patch" # By default setup.py tries to determine the hy version using # git-describe(1). Unfourtunatly, this will return the version @@ -43,4 +44,5 @@ package() { rm -rf "$pkgdir"/usr/get_version } -sha512sums="ff578eb6ca70f82492b37bfcc41167e8f8d50337bbdd6b049edb654163b60156a65933aa723ea357fee0f84dc25837d70bd00251760fa2b00f599088e592d97c hy-0.18.0.tar.gz" +sha512sums="ff578eb6ca70f82492b37bfcc41167e8f8d50337bbdd6b049edb654163b60156a65933aa723ea357fee0f84dc25837d70bd00251760fa2b00f599088e592d97c hy-0.18.0.tar.gz +fa5c7cd7727a878020e683528a4cd358dc114263a9c65fdb178afd0be9ce5f67b1ff3209fe71f5c36e325c0ce7eac54f2fbe1a2fc647f800f9183edf73b6cc1e 0001-get_version.py-Also-write-VERSIONFILE-when-HY_VERSIO.patch"