[MDEV-14020] Choose specific python version Created: 2017-10-06  Updated: 2017-10-16  Resolved: 2017-10-08

Status: Closed
Project: MariaDB Server
Component/s: Packaging, Tests
Affects Version/s: 10.0, 10.1, 10.2
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Michal Schorm Assignee: Sergei Golubchik
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

Fedora RPMLint warnings:

These RPMs contain problematic shebang in some of the scripts:
mariadb-test-10.2.9-3.fc27
 * Scripts containing `#!/usr/bin/env python` shebang:
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/change_column_bin.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/change_column_bin_rename.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/change_column_char.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/change_column_char_binary.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/change_column_char_charbinary.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/change_column_char_rename.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/change_column_int.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/change_column_int_key.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/change_column_int_not_supported.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/change_column_int_rename.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/fast_update_blobs.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/fast_update_blobs_fixed_varchar.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/fast_update_blobs_with_varchar.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/fast_update_decr_floor.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/fast_update_int.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/fast_update_varchar.py
   /usr/share/mysql-test/plugin/tokudb/tokudb/t/fast_upsert_int.py
This is discouraged and should be avoided. Please check the shebangs
and use either `#!/usr/bin/python2` or `#!/usr/bin/python3`.
 
 
Read the following document to find more information and a possible cause:
 https://pagure.io/packaging-committee/issue/698
Or ask at #fedora-python IRC channel for help.
 
If you think the result is false or intentional, file a bug against:
https://github.com/fedora-python/task-python-versions/issues



 Comments   
Comment by Sergei Golubchik [ 2017-10-06 ]

I've read https://pagure.io/packaging-committee/issue/698, the main idea seems to be

packages in Fedora must not depend on where /usr/bin/python happens to point but instead must call the proper executable for the needed python major version directly

which makes perfect sense. But I didn't find what to do when a package does not depend on where /usr/bin/python points, because it works equally well with either python2 or python3.

Comment by Sergei Golubchik [ 2017-10-06 ]

and

#!/usr/bin/env python

is not allowed either. Well, there's always

#!/bin/sh
''''exec python "$0" ${1+"$@"} # '''

and variations of it.

Comment by Michal Schorm [ 2017-10-07 ]

Sergei wrote:
" But I didn't find what to do when a package does not depend on where /usr/bin/python points, because it works equally well with either python2 or python3."

That's a good question, I'll found out.

I really won't start with anything like:

#!/bin/sh
''''exec python "$0" ${1+"$@"} # '''

It is meant to call thy python interpreter properly, not to irritate developers with workarounds.

I'll see what I'll find.

Comment by Michal Schorm [ 2017-10-07 ]

I'm back with the answer!

For Fedora, following apply:

"If the executables provide the same functionality independent of whether they are run on top of Python 2 or Python 3, then only the Python 3 version of the executable should be packaged."

https://fedoraproject.org/wiki/User:Churchyard/Packaging:Python

EDIT:
However, if you really don't depend on one, you can still use "any python shebang", and I'll pack it patched to "python3 shebang".
-> so, can be closed, I think.

Thanks

Comment by Michal Schorm [ 2017-10-07 ]

I pushed fix in Fedora mariadb package.

A simple 'sed' command, that adds the version, when package prepares to be built.

Comment by Sergei Golubchik [ 2017-10-08 ]

Better exclude these files altogether, don't package them. They aren't used at all — not by users, not by us. Just something that upstream (Tokutek, may be Percona too) used to use to generate test files, but test files are installed, so *.py files are absolutely never needed.

Why would they introduce an additional python3 dependency...

Comment by Michal Schorm [ 2017-10-16 ]

I updated the solution and removed those files.

Generated at Thu Feb 08 08:10:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.