Skip to content

Commit

Permalink
Create 0001-Use-env-var-PILLOW_HEIF_VERSION-to-get-version.patch
Browse files Browse the repository at this point in the history
Signed-off-by: madomado <[email protected]>
  • Loading branch information
madonuko authored Jul 1, 2024
1 parent bebd70a commit 1dadce5
Showing 1 changed file with 54 additions and 0 deletions.
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

0 comments on commit 1dadce5

Please sign in to comment.