Merge commit 'd0fdb0d759b960b41b57bf7c9539901f16062e0a' into epel7
This commit is contained in:
commit
6c4c3f3681
108
macros.python
108
macros.python
|
@ -1,51 +1,73 @@
|
||||||
%py_setup setup.py
|
%py_setup setup.py
|
||||||
%py_shbang_opts -s
|
%py_shbang_opts -s
|
||||||
|
|
||||||
%py_build() %{expand:\
|
# Use the slashes after expand so that the command starts on the same line as
|
||||||
CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py_shbang_opts}" %{?1}\
|
# the macro
|
||||||
|
%py_build() %{expand:\\\
|
||||||
|
CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py_shbang_opts}" %{?*}
|
||||||
|
sleep 1
|
||||||
}
|
}
|
||||||
|
|
||||||
%py_install() %{expand:\
|
%py_build_egg() %{expand:\\\
|
||||||
CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
|
CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
|
||||||
|
sleep 1
|
||||||
}
|
}
|
||||||
|
|
||||||
%python_provide() %{lua:\
|
%py_build_wheel() %{expand:\\\
|
||||||
function string.starts(String,Start)\
|
CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
|
||||||
return string.sub(String,1,string.len(Start))==Start\
|
sleep 1
|
||||||
end\
|
}
|
||||||
package = rpm.expand("%{?1:%{1}}");\
|
|
||||||
vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
|
%py_install() %{expand:\\\
|
||||||
if (string.starts(package, "python2-")) then\
|
CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
|
||||||
if (rpm.expand("%{?buildarch}") ~= "noarch") then\
|
}
|
||||||
str = "Provides: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} = " .. vr;\
|
|
||||||
print(rpm.expand(str));\
|
%py_install_egg() %{expand:\\\
|
||||||
end\
|
mkdir -p %{buildroot}%{python_sitelib}
|
||||||
print("\\nProvides: python-");\
|
easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python_version}.egg %{?*}
|
||||||
print(string.sub(package,9,string.len(package)));\
|
}
|
||||||
print(" = ");\
|
|
||||||
print(vr);\
|
%py_install_wheel() %{expand:\\\
|
||||||
--Obsoleting the previous default python package\
|
pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
|
||||||
print("\\nObsoletes: python-");\
|
}
|
||||||
print(string.sub(package,9,string.len(package)));\
|
|
||||||
print(" < ");\
|
%python_provide() %{lua:
|
||||||
print(vr);\
|
function string.starts(String,Start)
|
||||||
elseif (string.starts(package, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then\
|
return string.sub(String,1,string.len(Start))==Start
|
||||||
--No unversioned provides as python3 is not default\
|
end
|
||||||
elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then\
|
package = rpm.expand("%{?1}")
|
||||||
--No unversioned provides as python3_other is not default\
|
vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
|
||||||
elseif (string.starts(package, "pypy-")) then\
|
if (string.starts(package, "python2-")) then
|
||||||
--No unversioned provides as pypy is not default\
|
if (rpm.expand("%{?buildarch}") ~= "noarch") then
|
||||||
elseif (string.starts(package, "pypy3-")) then\
|
str = "Provides: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} = " .. vr
|
||||||
--No unversioned provides as pypy is not default\
|
print(rpm.expand(str))
|
||||||
elseif (string.starts(package, "python-")) then\
|
end
|
||||||
--Providing the current default python\
|
print("\\nProvides: python-")
|
||||||
print("Provides: python2-");\
|
print(string.sub(package,9,string.len(package)))
|
||||||
print(string.sub(package,8,string.len(package)));\
|
print(" = ")
|
||||||
print(" = ");\
|
print(vr)
|
||||||
print(vr);\
|
--Obsoleting the previous default python package
|
||||||
else\
|
print("\\nObsoletes: python-")
|
||||||
print("%python_provide: ERROR: ");\
|
print(string.sub(package,9,string.len(package)))
|
||||||
print(package);\
|
print(" < ")
|
||||||
print(" not recognized.");\
|
print(vr)
|
||||||
end\
|
elseif (string.starts(package, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then
|
||||||
|
--No unversioned provides as python3 is not default
|
||||||
|
elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then
|
||||||
|
--No unversioned provides as python3_other is not default
|
||||||
|
elseif (string.starts(package, "pypy-")) then
|
||||||
|
--No unversioned provides as pypy is not default
|
||||||
|
elseif (string.starts(package, "pypy3-")) then
|
||||||
|
--No unversioned provides as pypy is not default
|
||||||
|
elseif (string.starts(package, "python-")) then
|
||||||
|
--Providing the current default python
|
||||||
|
print("Provides: python2-")
|
||||||
|
print(string.sub(package,8,string.len(package)))
|
||||||
|
print(" = ")
|
||||||
|
print(vr)
|
||||||
|
else
|
||||||
|
print("%python_provide: ERROR: ")
|
||||||
|
print(package)
|
||||||
|
print(" not recognized.")
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,3 +7,58 @@
|
||||||
%__python3_other /bin/true
|
%__python3_other /bin/true
|
||||||
%py3_other_build /bin/true
|
%py3_other_build /bin/true
|
||||||
%py3_other_install /bin/true
|
%py3_other_install /bin/true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# === Macros for Build/Requires tags using Python dist tags ===
|
||||||
|
# - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
|
||||||
|
# - These macros need to be in macros.python-srpm, because BuildRequires tags
|
||||||
|
# get rendered as runtime requires into the metadata of SRPMs.
|
||||||
|
|
||||||
|
# Converts Python dist name to a canonical format
|
||||||
|
%py_dist_name() %{lua:\
|
||||||
|
name = rpm.expand("%{?1:%{1}}");\
|
||||||
|
canonical = string.gsub(string.lower(name), "%W+", "-");\
|
||||||
|
print(canonical);\
|
||||||
|
}
|
||||||
|
|
||||||
|
# Creates Python 2 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
|
||||||
|
%py2_dist() %{lua:\
|
||||||
|
args = {}\
|
||||||
|
arg = 1\
|
||||||
|
while (true) do\
|
||||||
|
name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\
|
||||||
|
if (name == nil or name == '') then\
|
||||||
|
break\
|
||||||
|
end\
|
||||||
|
args[arg] = name\
|
||||||
|
arg = arg + 1\
|
||||||
|
end\
|
||||||
|
for arg, name in ipairs(args) do\
|
||||||
|
canonical = rpm.expand("%py_dist_name " .. name);\
|
||||||
|
print("python2dist(" .. canonical .. ") ");\
|
||||||
|
end\
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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:\
|
||||||
|
args = {}\
|
||||||
|
arg = 1\
|
||||||
|
while (true) do\
|
||||||
|
name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\
|
||||||
|
if (name == nil or name == '') then\
|
||||||
|
break\
|
||||||
|
end\
|
||||||
|
args[arg] = name\
|
||||||
|
arg = arg + 1\
|
||||||
|
end\
|
||||||
|
for arg, name in ipairs(args) do\
|
||||||
|
canonical = rpm.expand("%py_dist_name " .. name);\
|
||||||
|
print("python3dist(" .. canonical .. ") ");\
|
||||||
|
end\
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,32 @@
|
||||||
|
|
||||||
%py2_shbang_opts -s
|
%py2_shbang_opts -s
|
||||||
|
|
||||||
%py2_build() %{expand:\
|
# Use the slashes after expand so that the command starts on the same line as
|
||||||
CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?1};\
|
# the macro
|
||||||
sleep 1\
|
%py2_build() %{expand:\\\
|
||||||
|
CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?*}
|
||||||
|
sleep 1
|
||||||
}
|
}
|
||||||
|
|
||||||
%py2_install() %{expand:\
|
%py2_build_egg() %{expand:\\\
|
||||||
CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
|
CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
|
||||||
|
sleep 1
|
||||||
|
}
|
||||||
|
|
||||||
|
%py2_build_wheel() %{expand:\\\
|
||||||
|
CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
|
||||||
|
sleep 1
|
||||||
|
}
|
||||||
|
|
||||||
|
%py2_install() %{expand:\\\
|
||||||
|
CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
|
||||||
|
}
|
||||||
|
|
||||||
|
%py2_install_egg() %{expand:\\\
|
||||||
|
mkdir -p %{buildroot}%{python2_sitelib}
|
||||||
|
easy_install-%{python2_version} -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python2_version}.egg %{?*}
|
||||||
|
}
|
||||||
|
|
||||||
|
%py2_install_wheel() %{expand:\\\
|
||||||
|
pip%{python2_version} install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,32 @@
|
||||||
|
|
||||||
%py3_shbang_opts -s
|
%py3_shbang_opts -s
|
||||||
|
|
||||||
%py3_build() %{expand:\
|
# Use the slashes after expand so that the command starts on the same line as
|
||||||
CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?1};\
|
# the macro
|
||||||
sleep 1\
|
%py3_build() %{expand:\\\
|
||||||
|
CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?*}
|
||||||
|
sleep 1
|
||||||
}
|
}
|
||||||
|
|
||||||
%py3_install() %{expand:\
|
%py3_build_egg() %{expand:\\\
|
||||||
CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
|
CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
|
||||||
|
sleep 1
|
||||||
|
}
|
||||||
|
|
||||||
|
%py3_build_wheel() %{expand:\\\
|
||||||
|
CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
|
||||||
|
sleep 1
|
||||||
|
}
|
||||||
|
|
||||||
|
%py3_install() %{expand:\\\
|
||||||
|
CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
|
||||||
|
}
|
||||||
|
|
||||||
|
%py3_install_egg() %{expand:\\\
|
||||||
|
mkdir -p %{buildroot}%{python3_sitelib}
|
||||||
|
easy_install-%{python3_version} -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python3_version}.egg %{?*}
|
||||||
|
}
|
||||||
|
|
||||||
|
%py3_install_wheel() %{expand:\\\
|
||||||
|
pip%{python3_version} install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Name: python-rpm-macros
|
Name: python-rpm-macros
|
||||||
Version: 3
|
Version: 3
|
||||||
Release: 11%{?dist}
|
Release: 17%{?dist}
|
||||||
Summary: The unversioned Python RPM macros
|
Summary: The unversioned Python RPM macros
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
|
@ -63,6 +63,29 @@ install -m 644 %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} \
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jan 23 2017 Michal Cyprian <mcyprian@redhat.com> - 3-17
|
||||||
|
- Add --no-deps option to py_install_wheel macros
|
||||||
|
|
||||||
|
* Tue Jan 17 2017 Tomas Orsava <torsava@redhat.com> - 3-16
|
||||||
|
- Added macros for Build/Requires tags using Python dist tags:
|
||||||
|
https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
|
||||||
|
|
||||||
|
* Thu Nov 24 2016 Orion Poplawski <orion@cora.nwra.com> 3-15
|
||||||
|
- Make expanded macros start on the same line as the macro
|
||||||
|
|
||||||
|
* Wed Nov 16 2016 Orion Poplawski <orion@cora.nwra.com> 3-14
|
||||||
|
- Fix %%py3_install_wheel (bug #1395953)
|
||||||
|
|
||||||
|
* Wed Nov 16 2016 Orion Poplawski <orion@cora.nwra.com> 3-13
|
||||||
|
- Add missing sleeps to other build macros
|
||||||
|
- Fix build_egg macros
|
||||||
|
- Add %%py_build_wheel and %%py_install_wheel macros
|
||||||
|
|
||||||
|
* Tue Nov 15 2016 Orion Poplawski <orion@cora.nwra.com> 3-12
|
||||||
|
- Add %%py_build_egg and %%py_install_egg macros
|
||||||
|
- Allow multiple args to %%py_build/install macros
|
||||||
|
- Tidy up macro formatting
|
||||||
|
|
||||||
* Wed Aug 24 2016 Orion Poplawski <orion@cora.nwra.com> 3-11
|
* Wed Aug 24 2016 Orion Poplawski <orion@cora.nwra.com> 3-11
|
||||||
- Use %%rpmmacrodir
|
- Use %%rpmmacrodir
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue