[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: python3 script header and rhel8
From: |
John Snow |
Subject: |
Re: python3 script header and rhel8 |
Date: |
Tue, 28 Jan 2020 16:51:58 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 |
On 1/28/20 11:07 AM, Daniel P. Berrangé wrote:
> On Tue, Jan 28, 2020 at 03:44:04PM +0000, Vladimir Sementsov-Ogievskiy wrote:
>> Hi all!
>>
>> Hmm Qemu dropped support for python2, and anyway python2 is not supported
>> now at all.
>>
>> Still, we have a lot of "#!/usr/bin/env python" headings in our scripts,
>> which is
>> unsupported by rhel8 by default. So, for example, because of such line in
>> tests/qemu-iotests/nbd-fault-injector.py, iotest 277 fails.
>>
>> Of course, it's simple to set python in rhel8 to be python3... But should we
>> fix
>> all the headings to be "#!/usr/bin/env python3"? Or what is the correct
>> heading
>> for scripts in a new python3 world?
>
> Using "#!/usr/bin/env python3" is probably our best choice, as it
> makes it absolutely clear we're not happy with a python2 impl.
>
On using 'env' or not: for any script anticipated to be executed
directly from the command line, a hardcoded path will inhibit idiomatic
virtual environment usage, so 'env' is preferred.
On python vs python2 vs python3:
https://www.python.org/dev/peps/pep-0394/
PEP 0394 states that 'python3' should be available and that 'python' is
optional.
That answers that, in my opinion. Let's make `#!/usr/bin/env python3`
ubiquitous.
--js