Fix python3 issues in libglib.

This commit is contained in:
Jonas 'Sortie' Termansen 2024-07-22 18:38:15 +02:00
parent 5b586bb65f
commit cc9f4cc515

View file

@ -1,3 +1,14 @@
diff -Paur --no-dereference -- libglib.upstream/Makefile.in libglib/Makefile.in
--- libglib.upstream/Makefile.in
+++ libglib/Makefile.in
@@ -1792,6 +1792,7 @@
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
+ -find . -name '*.pyc' -delete
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-local distclean-tags
diff -Paur --no-dereference -- libglib.upstream/configure libglib/configure
--- libglib.upstream/configure
+++ libglib/configure
@ -113,6 +124,15 @@ diff -Paur --no-dereference -- libglib.upstream/configure libglib/configure
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
diff -Paur --no-dereference -- libglib.upstream/gio/data-to-c.py libglib/gio/data-to-c.py
--- libglib.upstream/gio/data-to-c.py
+++ libglib/gio/data-to-c.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
diff -Paur --no-dereference -- libglib.upstream/gio/ginetsocketaddress.c libglib/gio/ginetsocketaddress.c
--- libglib.upstream/gio/ginetsocketaddress.c
+++ libglib/gio/ginetsocketaddress.c
@ -334,14 +354,45 @@ diff -Paur --no-dereference -- libglib.upstream/glib/Makefile.in libglib/glib/Ma
-rm -f ./$(DEPDIR)/gspawn-win32-helper.Po
-rm -f ./$(DEPDIR)/gspawn-win64-helper-console.Po
-rm -f ./$(DEPDIR)/gspawn-win64-helper.Po
diff -Paur --no-dereference -- libglib.upstream/Makefile.in libglib/Makefile.in
--- libglib.upstream/Makefile.in
+++ libglib/Makefile.in
@@ -1792,6 +1792,7 @@
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
+ -find . -name '*.pyc' -delete
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-local distclean-tags
diff -Paur --no-dereference -- libglib.upstream/py-compile libglib/py-compile
--- libglib.upstream/py-compile
+++ libglib/py-compile
@@ -116,7 +116,7 @@
fi
$PYTHON -c "
-import sys, os, py_compile, imp
+import sys, os, py_compile, importlib
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, importlib.util.cache_from_source(filepath), 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, importlib
# 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, importlib.util.cache_from_source(filepath, False), path)
sys.stdout.write('\n')" 2>/dev/null || :
# Local Variables: