diff --git a/anda/langs/python/pillow-heif/0001-Use-env-var-PILLOW_HEIF_VERSION-to-get-version.patch b/anda/langs/python/pillow-heif/0001-Use-env-var-PILLOW_HEIF_VERSION-to-get-version.patch new file mode 100644 index 0000000000..de0ef1b1ad --- /dev/null +++ b/anda/langs/python/pillow-heif/0001-Use-env-var-PILLOW_HEIF_VERSION-to-get-version.patch @@ -0,0 +1,54 @@ +From 36e9ceb4bc3977533f52d7cdcbfe8867dc5243dc Mon Sep 17 00:00:00 2001 +From: madonuko +Date: Mon, 1 Jul 2024 12:14:13 +0800 +Subject: [PATCH] Use env-var PILLOW_HEIF_VERSION to get version + +Somehow upstream uses horrible python code to dynamically run the +_version.py file to get the version. +--- + setup.py | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +diff --git a/setup.py b/setup.py +index b3bf0ce..e5365b0 100644 +--- a/setup.py ++++ b/setup.py +@@ -1,5 +1,6 @@ + #!/usr/bin/env python + """Script to build wheel.""" ++ + import os + import re + import subprocess +@@ -24,9 +25,7 @@ class RequiredDependencyException(Exception): + + def get_version(): + """Returns version of the project.""" +- version_file = "pillow_heif/_version.py" +- exec(compile(Path(version_file).read_text(encoding="utf-8"), version_file, "exec")) # pylint: disable=exec-used +- return locals()["__version__"] ++ os.environ("PILLOW_HEIF_VERSION") + + + def _cmd_exists(cmd: str) -> bool: +@@ -50,15 +49,11 @@ def _pkg_config(name): + libs = re.split( + r"(^|\s+)-L", + subprocess.check_output(command_libs, stderr=stderr).decode("utf8").strip(), +- )[ +- ::2 +- ][1:] ++ )[::2][1:] + cflags = re.split( + r"(^|\s+)-I", + subprocess.check_output(command_cflags).decode("utf8").strip(), +- )[ +- ::2 +- ][1:] ++ )[::2][1:] + return libs, cflags + except Exception: # noqa # pylint: disable=broad-exception-caught + pass +-- +2.45.2 +