Skip to content

Commit

Permalink
Add glib patch for Python 3.12 compatibility
Browse files Browse the repository at this point in the history
Co-authored-by: Jeroen Ooms <jeroenooms@gmail.com>
  • Loading branch information
georgestagg and jeroen committed Apr 29, 2024
1 parent 76054d4 commit f56f14a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
42 changes: 42 additions & 0 deletions patches/glib-2.56.4/fix-python12.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
diff -aurp glib-2.56.4.orig/py-compile glib-2.56.4/py-compile
--- glib-2.56.4.orig/py-compile 2024-04-28 22:15:25
+++ glib-2.56.4/py-compile 2024-04-28 22:16:15
@@ -116,7 +116,7 @@ $PYTHON -c "
fi

$PYTHON -c "
-import sys, os, py_compile, imp
+import sys, os, py_compile

files = '''$files'''

@@ -129,15 +129,12 @@ for file in files.split():
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 @@ for file in files.split():
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:
1 change: 1 addition & 0 deletions patches/glib-2.56.4/series
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ emscripten-configure.diff
emscripten-function-ptr.diff
emscripten-wasm.diff
emscripten-disable-pcre.diff
fix-python12.diff

0 comments on commit f56f14a

Please sign in to comment.