[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fix python3 deprecation warning
From: |
Karl Berry |
Subject: |
Re: Fix python3 deprecation warning |
Date: |
Sun, 16 Feb 2020 19:09:37 -0700 |
Hi Gabriel - back on your patch from last July (sorry):
https://lists.gnu.org/archive/html/automake-patches/2019-07/msg00002.html
replace the imp functions with the new ones from importlib.
...
-import sys, os, py_compile, imp
+import sys, os, py_compile, importlib
I understand the problem, but unfortunately the new code is not
compatible with Python 2. I don't know the best way to handle that. Help?
With the patch, the tests, e.g., py-compile-basedir, fail with the
not-unexpected:
+ ./py-compile --basedir foo __init__.py sub/__init__.py
Byte-compiling python modules...
__init__.pyTraceback (most recent call last):
File "<string>", line 15, in <module>
AttributeError: 'module' object has no attribute 'implementation'
I know Python 2 itself is being eradicated, but still, automake cannot
simply abandon it.
About all I can imagine is to change the above line to something like:
import sys, os, py_compile, $import_library
and check the version number of $PYTHON in the script before and set
$import_library accordingly. That is not especially pretty. Is there
a way to do it within Python that would be cleaner and work with both
versions?
I also don't see the deprecation warning, but I only have Python 3.6.8
at the moment, so I suppose it came in with Python 3.7. --thanks, karl.
- Re: Fix python3 deprecation warning,
Karl Berry <=