On 2020-05-06 13:44, Miro Hrončok wrote:
In this change:

https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error

We have advised the following:

   pathfix.py -pni "%{__python3} %{py3_shbang_opts}" <paths>

To fix the shebangs.

  -p preserves timestamps
  -n prevents creating ~backup files
  -i specifies the interpreter for the shebang

Now we have new features and we ultimately want this for the best experience:

   pathfix.py -pni %{python3} -ka %{py3_shbang_opts_nodash}

  -k keeps existing flags
  -a adds our flags (if not already there)
  %py3_shbang_opts_nodash is derived from %py3_shbang_opts

This is very tedious copypasta.

I propose we macronize this as follows:

We create %py3_shebang_flags. By default, it is the same as %py3_shbang_opts without dash to avoid confusion, but it can be overridden. Note the proper "e" in the name.

We create %py3_shebang_fix:

Bikeshed: "%py3_fix_shebang" is a verb


  pathfix.py -pni %{__python3} -k%{?py3_shebang_flags:a %py3_shebang_flags}

Usage:

   %prep
   %autosetup
   %py3_shebang_fix .

Or:

   %install
   ...install stuff...
  %py3_shebang_fix %{buildroot}%{python3_sitearch} %{buildroot}%{_bindir}/*

+1
_______________________________________________
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org

Reply via email to