automake-patches
[Top][All Lists]
Advanced

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

Re: Fix python3 deprecation warning


From: Gabriel Ganne
Subject: Re: Fix python3 deprecation warning
Date: Wed, 19 Feb 2020 10:21:04 +0100

Hi Karl,

Thanks for reviewing.
I had not thought about it, but it is absolutely true that autotools should
not drop python2 support.

I had a look at when the imp module has been explicitly deprecated. In
cpython, it has been flagged so in commit
e4f41deccf94ccc798b1eb1f44657ade66669a60, which is part of releases >= 3.4.
I would have expected your version of python to raise a warning. Maybe it's
a distribution specific change ?
I checked Debian Jessie (old-old-stable) which uses 3.4, and already has
that warning.

I started to implement as you suggested but I found it heavy, and so I
propose to try the new code and to fallback
on the old version on error. Please tell me if this too much of an
optimistic approach.

Best regards,

On Mon, Feb 17, 2020 at 3:09 AM Karl Berry <address@hidden> wrote:

> 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.
>

-- 





**Attention: Confidential**

This email message is for the sole use of 
the intended recipient(s) and may contain confidential and/or privileged 
information.
Any unauthorized review, use, disclosure or distribution is 
prohibited.
If you are not the intended recipient, please contact me by 
reply email and destroy all copies of the original message.

Attachment: 0001-python3-fix-deprecation-warning.patch
Description: Text Data


reply via email to

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