package/avahi: fix python install issue
PATCH 1/1 package/avahi: fix python install issue
Since the update of Python to 3.12.4 in commit 76cd14167f5eb3ffe22e131ddbbecf9bc61f2ef1 avahi fails to install python subcomponents. The reason is that the obsolete imp python modul is used. Add a patch to remove the imp dependency.
Fixes:
- http://autobuild.buildroot.net/results/2bf/2bf391b93362204917a560705bc402585334ab3c
--- .../0002-remove-imp-from-py-compile.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 package/avahi/0002-remove-imp-from-py-compile.patch
package/avahi/0002-remove-imp-from-py-compile.patch new file +50 -0
@@ -0,0 +1,50 @@ +Remove optional imp python module dependency. + +Upstream already removed py-compile entirely in their git repository, +so the patch is not appropiate for upstream. + +Signed-off-by: Waldemar Brodkorb <[email protected]> +Upstream: not appropiate + +diff -Nur avahi-0.8.orig/py-compile avahi-0.8/py-compile +--- avahi-0.8.orig/py-compile 2020-02-18 07:58:21.192417644 +0100 ++++ avahi-0.8/py-compile 2024-08-17 15:03:07.328733849 +0200 +@@ -116,7 +116,7 @@ + fi + + $PYTHON -c " +-import sys, os, py_compile, imp ++import sys, os, py_compile + + files = '''$files''' + +@@ -129,15 +129,12 @@ + continue + sys.stdout.write(file) + sys.stdout.flush() +- if hasattr(imp, 'get_tag'): +- py_compile.compile(filepath, imp.cache_from_source(filepath), path) +- else: +- py_compile.compile(filepath, filepath + 'c', path) ++ py_compile.compile(filepath, filepath + 'c', path) + sys.stdout.write('\n')" || exit $? + + # this will fail for python < 1.5, but that doesn't matter ... + $PYTHON -O -c " +-import sys, os, py_compile, imp ++import sys, os, py_compile + + # pypy does not use .pyo optimization + if hasattr(sys, 'pypy_translation_info'): +@@ -153,10 +150,7 @@ + continue + sys.stdout.write(file) + sys.stdout.flush() +- if hasattr(imp, 'get_tag'): +- py_compile.compile(filepath, imp.cache_from_source(filepath, False), path) +- else: +- py_compile.compile(filepath, filepath + 'o', path) ++ py_compile.compile(filepath, filepath + 'o', path) + sys.stdout.write('\n')" 2>/dev/null || : + + # Local Variables:
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedWaldemar, All,
On 2024-08-17 15:18 +0200, Waldemar Brodkorb spake thusly:
Quoted 9 lines
Since the update of Python to 3.12.4 in commit
76cd14167f5eb3ffe22e131ddbbecf9bc61f2ef1avahi fails to install python subcomponents. The reason is that the obsolete imp python modul is used. Add a patch to remove the imp dependency.Fixes:
- http://autobuild.buildroot.net/results/2bf/2bf391b93362204917a560705bc402585334ab3cSigned-off-by Waldemar Brodkorb <[email protected]>
Applied to master, thanks.
But see below
Quoted 11 lines
--- .../0002-remove-imp-from-py-compile.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 package/avahi/0002-remove-imp-from-py-compile.patchpackage/avahi/0002-remove-imp-from-py-compile.patch new file +0
-0
package/avahi/0002-remove-imp-from-py-compile.patch line 4
Quoted 4 lines
package/avahi/0002-remove-imp-from-py-compile.patch new file +4
-0@@ -0,0 +1,50 @@ +Remove optional imp python module dependency. + +Upstream already removed py-compile entirely in their git repository, +so the patch is not appropiate for upstream.
This is really weird: the git tree removed the py-comple in 2005, and it is not present in the v0.8 tag, but then the release tarball, that we use, does carry that file.
Could you see with upstream how they end up with py-compile in the released archive, while it is not in git?
There is a risk that that file gets added somehow by the autotools packagng process, so it will eventually be present in the next release as well, and we'd have to carry that patch forever and ever...
Regards,
Yann E. MORIN.
Quoted 52 lines
package/avahi/0002-remove-imp-from-py-compile.patch new file +45
-0+Signed-off-by: Waldemar Brodkorb <[email protected]> +Upstream: not appropiate + +diff -Nur avahi-0.8.orig/py-compile avahi-0.8/py-compile +--- avahi-0.8.orig/py-compile 2020-02-18 07:58:21.192417644 +0100 ++++ avahi-0.8/py-compile 2024-08-17 15:03:07.328733849 +0200 +@@ -116,7 +116,7 @@ + fi + + $PYTHON -c " +-import sys, os, py_compile, imp ++import sys, os, py_compile + + files = '''$files''' + +@@ -129,15 +129,12 @@ + continue + sys.stdout.write(file) + sys.stdout.flush() +- if hasattr(imp, 'get_tag'): +- py_compile.compile(filepath, imp.cache_from_source(filepath), path) +- else: +- py_compile.compile(filepath, filepath + 'c', path) ++ py_compile.compile(filepath, filepath + 'c', path) + sys.stdout.write('\n')" || exit $? + + # this will fail for python < 1.5, but that doesn't matter ... + $PYTHON -O -c " +-import sys, os, py_compile, imp ++import sys, os, py_compile + + # pypy does not use .pyo optimization + if hasattr(sys, 'pypy_translation_info'): +@@ -153,10 +150,7 @@ + continue + sys.stdout.write(file) + sys.stdout.flush() +- if hasattr(imp, 'get_tag'): +- py_compile.compile(filepath, imp.cache_from_source(filepath, False), path) +- else: +- py_compile.compile(filepath, filepath + 'o', path) ++ py_compile.compile(filepath, filepath + 'o', path) + sys.stdout.write('\n')" 2>/dev/null || : + + # Local Variables:Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Yann,
Yann E. MORIN wrote,
Quoted 8 lines
Waldemar, All,
On 2024-08-17 15:18 +0200, Waldemar Brodkorb spake thusly:
Quoted 5 lines
Since the update of Python to 3.12.4 in commit
76cd14167f5eb3ffe22e131ddbbecf9bc61f2ef1avahi fails to install python subcomponents. The reason is that the obsolete imp python modul is used. Add a patch to remove the imp dependency.
Quoted 6 lines
Quoted 4 lines
Fixes:
- http://autobuild.buildroot.net/results/2bf/2bf391b93362204917a560705bc402585334ab3cSigned-off-by Waldemar Brodkorb <[email protected]>Applied to master, thanks.
Thanks you.
Quoted 22 lines
But see below
Quoted 11 lines
--- .../0002-remove-imp-from-py-compile.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 package/avahi/0002-remove-imp-from-py-compile.patchpackage/avahi/0002-remove-imp-from-py-compile.patch new file +0
-0package/avahi/0002-remove-imp-from-py-compile.patch line 4
Quoted 4 lines
package/avahi/0002-remove-imp-from-py-compile.patch new file +4
-0@@ -0,0 +1,50 @@ +Remove optional imp python module dependency. + +Upstream already removed py-compile entirely in their git repository, +so the patch is not appropiate for upstream.This is really weird: the git tree removed the py-comple in 2005, and it is not present in the v0.8 tag, but then the release tarball, that we use, does carry that file.
Quoted 6 lines
Could you see with upstream how they end up with py-compile in the released archive, while it is not in git?
There is a risk that that file gets added somehow by the autotools packagng process, so it will eventually be present in the next release as well, and we'd have to carry that patch forever and ever...
You are right, py-compile is generated.
But in avahi git you get one with following code:
python_major=$PYTHON -V 2>&1 | sed -e 's/.* //;s/\..*$//;1q' if test -z "$python_major"; then
echo "$me: could not determine $PYTHON major version, guessing 3" >&2 python_major=3
fi
# The old way to import libraries was deprecated.
if test "$python_major" -le 2; then
import_lib=imp
import_test="hasattr(imp, 'get_tag')" import_call=imp.cache_from_source
import_arg2=', False' # needed in one call and not the other
else
import_lib=importlib import_test="hasattr(sys.implementation, 'cache_tag')" import_call=importlib.util.cache_from_source import_arg2=
fi
$PYTHON -c "
import sys, os, py_compile, $import_lib
...
So I believe newer Python version is handled there.
best regards
Waldemar
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot