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:
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}/*
As a side not, is it possible to have conditonal expansion not expand on empty macro?
E.g. this works:
%undefine py3_shebang_flags %{?py3_shebang_flags:a %py3_shebang_flags} -> nothing
But this does not:
%global py3_shebang_flags %{nil} %{?py3_shebang_flags:a %py3_shebang_flags} -> a
If not, we'll advise the users to undefine when they want "empty flags".
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@lists.fedoraproject.org