From fd58ab3bee7a79cb0a7870c6858f3b64c84a7917 Mon Sep 17 00:00:00 2001 From: Jehan Date: Tue, 3 Feb 2026 10:27:41 +0100 Subject: [PATCH] libgimp: use the file directory as base for pygimp module. This will allow calling this script from elsewhere. --- libgimp/tests/libgimp-run-python-test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libgimp/tests/libgimp-run-python-test.py b/libgimp/tests/libgimp-run-python-test.py index fef653c309..6ca32ae272 100644 --- a/libgimp/tests/libgimp-run-python-test.py +++ b/libgimp/tests/libgimp-run-python-test.py @@ -8,6 +8,8 @@ GIMP_EXE = sys.argv[1] TEST_FILE = sys.argv[2] SRC_DIR = os.path.dirname(TEST_FILE) SRC_DIR = Path(os.path.realpath(SRC_DIR)).resolve().as_posix() +PYGIMP_DIR = os.path.dirname(__file__) +PYGIMP_DIR = Path(os.path.realpath(PYGIMP_DIR)).resolve().as_posix() if not os.path.isfile(TEST_FILE): print(f"ERROR: file '{TEST_FILE}' does not exist!") @@ -24,7 +26,7 @@ if first_char != '#': print(f"ERROR: file '{TEST_FILE}' should start with a shebang: #!/usr/bin/env python3") sys.exit(1) -header = f"""import os; import sys; sys.path.insert(0, '{SRC_DIR}'); from pygimp.utils import gimp_assert; +header = f"""import os; import sys; sys.path.insert(0, '{PYGIMP_DIR}'); from pygimp.utils import gimp_assert; import pygimp.utils; pygimp.utils.gimp_test_filename = '{TEST_FILE}'""" with open(TEST_FILE, 'r') as f: