| |
@@ -41,10 +41,28 @@
|
| |
end\
|
| |
}
|
| |
|
| |
+ # RHEL 9+ and Fedora compatibility macro
|
| |
+ # Only use in macro backports, not intended to be used in spec files!
|
| |
+ # In the future, the %%python3_pkgversion macro has a dot, e.g. 3.9 or 3.11
|
| |
+ # However, in RHEL 8 at least, it does not, e.g. 38, 39
|
| |
+ # This is a helpful macro that determines the proper "Python version" string with dot
|
| |
+ # from %%python3_pkgversion without actually having Python installed.
|
| |
+ # For values other than 3X, it should expand to %%python3_pkgversion unchanged.
|
| |
+ # Examples of %%python3_pkgversion -> %%_python3_pkgversion_with_dot:
|
| |
+ # 3 -> 3
|
| |
+ # 38 -> 3.8
|
| |
+ # 39 -> 3.9
|
| |
+ # 310 -> 3.10
|
| |
+ # 3.12 -> 3.12
|
| |
+ # 4 -> 4
|
| |
+ # 412 -> 412
|
| |
+ %_python3_pkgversion_with_dot %{lua:print((rpm.expand("%python3_pkgversion"):gsub('^3(%d)', '3.%1')))}
|
| |
+
|
| |
# Creates Python 3 dist tag(s) after converting names to canonical format
|
| |
# Needs to first put all arguments into a list, because invoking a different
|
| |
# macro (%py_dist_name) overwrites them
|
| |
%py3_dist() %{lua:\
|
| |
+ python3_pkgversion_with_dot = rpm.expand("%_python3_pkgversion_with_dot")\
|
| |
args = {}\
|
| |
arg = 1\
|
| |
while (true) do\
|
| |
@@ -57,7 +75,7 @@
|
| |
end\
|
| |
for arg, name in ipairs(args) do\
|
| |
canonical = rpm.expand("%py_dist_name " .. name);\
|
| |
- print("python3dist(" .. canonical .. ") ");\
|
| |
+ print("python" .. python3_pkgversion_with_dot .. "dist(" .. canonical .. ") ");\
|
| |
end\
|
| |
}
|
| |
|
| |
By default, %{py3_dist foo} generates python3dist(foo).
This change makes it respect %python3_pkgversion so when
it is redefined as X.Y, %{py3_dist foo} generates pythonX.Y(foo).
This is a modified backport of https://src.fedoraproject.org/rpms/python-rpm-macros/c/638f809f4c15b8b14dfc1f6f8c3c08b0d2ba0b70
In addition,
:gsub('^3(%d)', '3.%1')
was added.It makes sure that values of %python3_pkgversion without dot
are converted to values with dots.
In RHEL 8, at least until Python 3.9, the %python3_pkgversion value is 39.
It is written in a way that allows us to use 3.10 for the next version if desired.
The default behavior is reasonable:
The value for non-3 %python3_pkgversion is preserved as is:
Co-authored-by: @lbalhar