summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-libs/pacparser/files/pacparser-1.4.0-pymod.patch')
-rw-r--r--net-libs/pacparser/files/pacparser-1.4.0-pymod.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/net-libs/pacparser/files/pacparser-1.4.0-pymod.patch b/net-libs/pacparser/files/pacparser-1.4.0-pymod.patch
new file mode 100644
index 000000000000..203e34c838f1
--- /dev/null
+++ b/net-libs/pacparser/files/pacparser-1.4.0-pymod.patch
@@ -0,0 +1,61 @@
+Upstream-PR: https://github.com/manugarg/pacparser/pull/137
+From 351b8f837ebbdf6e6fa4978a70287899436890eb Mon Sep 17 00:00:00 2001
+From: orbea <orbea@riseup.net>
+Date: Sat, 14 May 2022 01:46:25 -0700
+Subject: [PATCH] tests: Fix python path in runtests.py
+
+In Gentoo the runtests.py script fails when it fails to determine the
+pacparser path.
+
+This happens because 'py_ver' expands to '3.9' when the expected
+directory ends in '39'. This can be solved by replacing any periods in
+the string.
+
+python ../tests/runtests.py
+Traceback (most recent call last):
+ File "/tmp/pacparser/src/../tests/runtests.py", line 31, in runtests
+ pacparser_module_path = glob.glob(os.path.join(
+IndexError: list index out of range
+
+During handling of the above exception, another exception occurred:
+
+Traceback (most recent call last):
+ File "/tmp/pacparser/src/../tests/runtests.py", line 81, in <module>
+ main()
+ File "/tmp/pacparser/src/../tests/runtests.py", line 78, in main
+ runtests(pacfile, testdata, tests_dir)
+ File "/tmp/pacparser/src/../tests/runtests.py", line 34, in runtests
+ raise Exception('Tests failed. Could not determine pacparser path.')
+Exception: Tests failed. Could not determine pacparser path.
+---
+ tests/runtests.py | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/tests/runtests.py b/tests/runtests.py
+index 9760300..a5377d1 100644
+--- a/tests/runtests.py
++++ b/tests/runtests.py
+@@ -26,10 +26,20 @@
+ import sys
+
+ def runtests(pacfile, testdata, tests_dir):
+- py_ver = '.'.join([str(x) for x in sys.version_info[0:2]])
++ ver = '.'.join([str(x) for x in sys.version_info[0:2]])
++ py_ver = [ver, ver.replace('.', '')]
+ try:
+- pacparser_module_path = glob.glob(os.path.join(
+- tests_dir, '..', 'src', 'pymod', 'build', 'lib*%s' % py_ver))[0]
++ module_path = glob.glob(os.path.join(
++ tests_dir, '..', 'src', 'pymod', 'build', 'lib*'))
++ module_found = False
++ for module in module_path:
++ for version in py_ver:
++ if module.endswith(version):
++ module_found = True
++ break
++ if module_found:
++ pacparser_module_path = module
++ break
+ except Exception:
+ raise Exception('Tests failed. Could not determine pacparser path.')
+ if 'DEBUG' in os.environ: print('Pacparser module path: %s' %