-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create 0001-Use-env-var-PILLOW_HEIF_VERSION-to-get-version.patch
Signed-off-by: madomado <[email protected]>
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
anda/langs/python/pillow-heif/0001-Use-env-var-PILLOW_HEIF_VERSION-to-get-version.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
From 36e9ceb4bc3977533f52d7cdcbfe8867dc5243dc Mon Sep 17 00:00:00 2001 | ||
From: madonuko <[email protected]> | ||
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 | ||
|