Make the unversioned %__python macro error
See https://fedoraproject.org/wiki/Changes/PythonMacroError While doing it, make %python macros more consistent with %python3 macros, mostly wrt whitespace but also to use python -m pip over plain pip etc. One significant change is the removal of sleeps from python macros, this could affect packages that use python macros to build for Python 2 while also using python3 macros to build for Python 3. In reality, I consider that unlikely. The sleep in python2 macros stays. The --strip-file-prefix option was already removed from %pyX_install_wheel but we forgot to remove it from %py_install_wheel.
This commit is contained in:
parent
59abe832d4
commit
69b1b30d53
6 changed files with 46 additions and 22 deletions
|
|
@ -11,19 +11,11 @@
|
|||
%python2 %__python2
|
||||
%python3 %__python3
|
||||
|
||||
# For backwards compatibility only
|
||||
# See the comments in https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/22
|
||||
%__python /usr/bin/python
|
||||
# See https://fedoraproject.org/wiki/Changes/PythonMacroError
|
||||
%__python %{error:attempt to use unversioned python, define %%__python to %{__python2} or %{__python3} explicitly}
|
||||
|
||||
# Users can use %%python only if they redefined %%__python (e.g. to %%__python3)
|
||||
%python() %{lua:\
|
||||
__python = rpm.expand("%__python")\
|
||||
if __python == "/usr/bin/python" then\
|
||||
rpm.expand("%{error:Cannot use %%python if %%__python wasn't redefined to something other than /usr/bin/python.}")\
|
||||
else\
|
||||
print(__python)\
|
||||
end\
|
||||
}
|
||||
%python %__python
|
||||
|
||||
# There are multiple Python 3 versions packaged, but only one can be the "main" version
|
||||
# That means that it owns the "python3" namespace:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue