automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[automake-commit] 02/02: Port py-compile to Python 2.6-


From: Paul Eggert
Subject: [automake-commit] 02/02: Port py-compile to Python 2.6-
Date: Wed, 29 Mar 2023 21:08:03 -0400

eggert pushed a commit to branch master
in repository automake.

View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=c04c4e8856e3c933239959ce18e16599fcc04a8b

commit c04c4e8856e3c933239959ce18e16599fcc04a8b
Author: Paul Eggert <eggert@cs.ucla.edu>
AuthorDate: Wed Mar 29 18:07:10 2023 -0700

    Port py-compile to Python 2.6-
    
    * lib/py-compile: Port to Python 2.6 and earlier,
    which lack importlib.
---
 lib/py-compile | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/py-compile b/lib/py-compile
index e1496a08c..d11962e96 100755
--- a/lib/py-compile
+++ b/lib/py-compile
@@ -1,7 +1,7 @@
 #!/bin/sh
 # py-compile - Compile a Python program
 
-scriptversion=2022-09-26.22; # UTC
+scriptversion=2023-03-30.00; # UTC
 
 # Copyright (C) 2000-2023 Free Software Foundation, Inc.
 
@@ -139,7 +139,12 @@ python_minor=`$PYTHON -c 'import sys; 
print(sys.version_info[1])'`
 # First byte compile (no optimization) all the modules.
 # This works for all currently known Python versions.
 $PYTHON -c "
-import sys, os, py_compile, importlib
+import sys, os, py_compile
+
+try:
+    import importlib
+except ImportError:
+    importlib = None
 
 # importlib.util.cache_from_source was added in 3.4
 if (
@@ -166,7 +171,12 @@ sys.stdout.write('\n')" "$@" || exit $?
 
 # Then byte compile w/optimization all the modules.
 $PYTHON -O -c "
-import sys, os, py_compile, importlib
+import sys, os, py_compile
+
+try:
+    import importlib
+except ImportError:
+    importlib = None
 
 # importlib.util.cache_from_source was added in 3.4
 if (



reply via email to

[Prev in Thread] Current Thread [Next in Thread]