|
|
d38048d |
# unversioned macros: used with user defined __python, no longer part of rpm >= 4.15
|
|
|
536b2ef |
# __python is defined to error by default in the srpm macros
|
|
|
d38048d |
%python_sitelib %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
|
|
|
d38048d |
%python_sitearch %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
|
|
|
d38048d |
%python_version %(%{__python} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
|
|
|
d38048d |
%python_version_nodots %(%{__python} -Esc "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
|
|
|
d38048d |
|
|
Orion Poplawski |
ec28c77 |
%py_setup setup.py
|
|
Orion Poplawski |
ec28c77 |
%py_shbang_opts -s
|
|
|
e9f07b7 |
%py_shbang_opts_nodash %(opts=%{py_shbang_opts}; echo ${opts#-})
|
|
|
7237192 |
%py_shebang_flags %(opts=%{py_shbang_opts}; echo ${opts#-})
|
|
|
7237192 |
%py_shebang_fix %{expand:/usr/bin/pathfix.py -pni %{__python} -k%{?py_shebang_flags:a %py_shebang_flags}}
|
|
Orion Poplawski |
ec28c77 |
|
|
Orion Poplawski |
5ca1f52 |
# Use the slashes after expand so that the command starts on the same line as
|
|
Orion Poplawski |
5ca1f52 |
# the macro
|
|
Orion Poplawski |
5ca1f52 |
%py_build() %{expand:\\\
|
|
|
4904408 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
90b0bf7 |
%{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python} %{py_shbang_opts}" %{?*}
|
|
Orion Poplawski |
e7af332 |
sleep 1
|
|
Orion Poplawski |
ec28c77 |
}
|
|
Orion Poplawski |
ec28c77 |
|
|
Orion Poplawski |
5ca1f52 |
%py_build_egg() %{expand:\\\
|
|
|
4904408 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
4904408 |
%{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
|
|
Orion Poplawski |
e7af332 |
sleep 1
|
|
Orion Poplawski |
e7af332 |
}
|
|
Orion Poplawski |
e7af332 |
|
|
Orion Poplawski |
5ca1f52 |
%py_build_wheel() %{expand:\\\
|
|
|
4904408 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
4904408 |
%{__python} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
|
|
Orion Poplawski |
e7af332 |
sleep 1
|
|
Orion Poplawski |
f798c43 |
}
|
|
Orion Poplawski |
f798c43 |
|
|
Orion Poplawski |
5ca1f52 |
%py_install() %{expand:\\\
|
|
|
4904408 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
4904408 |
%{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
|
|
|
2314fd9 |
rm -rfv %{buildroot}%{_bindir}/__pycache__
|
|
Orion Poplawski |
ec28c77 |
}
|
|
Orion Poplawski |
ec28c77 |
|
|
Orion Poplawski |
5ca1f52 |
%py_install_egg() %{expand:\\\
|
|
Orion Poplawski |
f798c43 |
mkdir -p %{buildroot}%{python_sitelib}
|
|
Orion Poplawski |
f798c43 |
easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python_version}.egg %{?*}
|
|
|
2314fd9 |
rm -rfv %{buildroot}%{_bindir}/__pycache__
|
|
Orion Poplawski |
f798c43 |
}
|
|
Orion Poplawski |
f798c43 |
|
|
Orion Poplawski |
5ca1f52 |
%py_install_wheel() %{expand:\\\
|
|
|
d0fdb0d |
pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
|
|
|
2314fd9 |
rm -rfv %{buildroot}%{_bindir}/__pycache__
|
|
|
daf7d32 |
for distinfo in %{buildroot}%{python_sitelib}/*.dist-info %{buildroot}%{python_sitearch}/*.dist-info; do
|
|
|
daf7d32 |
if [ -f ${distinfo}/direct_url.json ]; then
|
|
|
daf7d32 |
rm -fv ${distinfo}/direct_url.json
|
|
|
daf7d32 |
sed -i '/direct_url.json/d' ${distinfo}/RECORD
|
|
|
daf7d32 |
fi
|
|
|
daf7d32 |
done
|
|
Orion Poplawski |
e7af332 |
}
|
|
Orion Poplawski |
e7af332 |
|
|
Orion Poplawski |
29e6636 |
%python_provide() %{lua:
|
|
|
b314efc |
local python = require "fedora.srpm.python"
|
|
Orion Poplawski |
29e6636 |
function string.starts(String,Start)
|
|
Orion Poplawski |
29e6636 |
return string.sub(String,1,string.len(Start))==Start
|
|
Orion Poplawski |
29e6636 |
end
|
|
|
b314efc |
local package = rpm.expand("%{?1}")
|
|
|
b314efc |
local vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
|
|
|
25355e4 |
local provides = python.python_altprovides(package, vr)
|
|
|
1b3e731 |
if (string.starts(package, "python3-")) then
|
|
|
25355e4 |
for i, provide in ipairs(provides) do
|
|
|
25355e4 |
print("\\nProvides: " .. provide)
|
|
|
b314efc |
end
|
|
|
1b3e731 |
--Obsoleting the previous default python package (if it doesn't have isa)
|
|
|
1b3e731 |
if (string.sub(package, "-1") ~= ")") then
|
|
|
1b3e731 |
print("\\nObsoletes: python-")
|
|
|
1b3e731 |
print(string.sub(package,9,string.len(package)))
|
|
|
b314efc |
print(" < " .. vr)
|
|
|
1b3e731 |
end
|
|
|
1b3e731 |
elseif (string.starts(package, "python" .. rpm.expand("%{__default_python3_pkgversion}") .. "-")) then
|
|
|
25355e4 |
for i, provide in ipairs(provides) do
|
|
|
25355e4 |
print("\\nProvides: " .. provide)
|
|
|
b314efc |
end
|
|
|
b67b47d |
--Obsoleting the previous default python package (if it doesn't have isa)
|
|
|
b67b47d |
if (string.sub(package, "-1") ~= ")") then
|
|
|
b67b47d |
print("\\nObsoletes: python-")
|
|
|
5f3e4d6 |
print(string.sub(package,11,string.len(package)))
|
|
|
b314efc |
print(" < " .. vr)
|
|
|
b67b47d |
end
|
|
|
1b3e731 |
elseif (string.starts(package, "python")) then
|
|
|
1b3e731 |
--No unversioned provides as other python3 cases are not the default
|
|
|
1b3e731 |
elseif (string.starts(package, "pypy")) then
|
|
|
1b3e731 |
--No unversioned provides as pypy is not default either
|
|
Orion Poplawski |
29e6636 |
else
|
|
Orion Poplawski |
29e6636 |
print("%python_provide: ERROR: ")
|
|
Orion Poplawski |
29e6636 |
print(package)
|
|
Orion Poplawski |
29e6636 |
print(" not recognized.")
|
|
Orion Poplawski |
29e6636 |
end
|
|
Orion Poplawski |
ec28c77 |
}
|
|
|
ec476c8 |
|
|
|
9b8fac0 |
%python_disable_dependency_generator() \
|
|
|
9b8fac0 |
%undefine __pythondist_requires \
|
|
|
ec476c8 |
%{nil}
|