|
|
80f01a |
# %%__python is defined in /usr/lib/rpm/macros to raise an error
|
|
|
80f01a |
# so if you don't redefine it, you'll get the same error from %%python
|
|
|
80f01a |
%python %__python
|
|
|
80f01a |
|
|
|
80f01a |
%python_platform_triplet %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))")
|
|
|
80f01a |
%python_ext_suffix %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
|
|
|
80f01a |
|
|
|
61e6f0 |
%py_setup setup.py
|
|
|
61e6f0 |
%py_shbang_opts -s
|
|
|
61e6f0 |
|
|
|
80f01a |
%py_shbang_opts_nodash %(opts=%{py_shbang_opts}; echo ${opts#-})
|
|
|
80f01a |
%py_shebang_flags %(opts=%{py_shbang_opts}; echo ${opts#-})
|
|
|
80f01a |
%py_shebang_fix %{expand:\\\
|
|
|
80f01a |
if [ -f /usr/bin/pathfix%{python_version}.py ]; then
|
|
|
80f01a |
pathfix=/usr/bin/pathfix%{python_version}.py
|
|
|
80f01a |
else
|
|
|
80f01a |
# unversioned pathfix.py provided by platform-python-devel
|
|
|
80f01a |
pathfix=/usr/bin/pathfix.py
|
|
|
80f01a |
fi
|
|
|
80f01a |
if [ -z "%{?py_shebang_flags}" ]; then
|
|
|
80f01a |
shebang_flags="-k"
|
|
|
80f01a |
else
|
|
|
80f01a |
shebang_flags="-ka%{py_shebang_flags}"
|
|
|
80f01a |
fi
|
|
|
80f01a |
$pathfix -pni %{__python} $shebang_flags}
|
|
|
80f01a |
|
|
|
61e6f0 |
# Use the slashes after expand so that the command starts on the same line as
|
|
|
61e6f0 |
# the macro
|
|
|
61e6f0 |
%py_build() %{expand:\\\
|
|
|
61e6f0 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
4f589d |
%{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python} %{py_shbang_opts}" %{?*}
|
|
|
61e6f0 |
sleep 1
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%py_build_egg() %{expand:\\\
|
|
|
61e6f0 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
61e6f0 |
%{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
|
|
|
61e6f0 |
sleep 1
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%py_build_wheel() %{expand:\\\
|
|
|
61e6f0 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
61e6f0 |
%{__python} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
|
|
|
61e6f0 |
sleep 1
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%py_install() %{expand:\\\
|
|
|
61e6f0 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
61e6f0 |
%{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%py_install_egg() %{expand:\\\
|
|
|
61e6f0 |
mkdir -p %{buildroot}%{python_sitelib}
|
|
|
61e6f0 |
easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python_version}.egg %{?*}
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%py_install_wheel() %{expand:\\\
|
|
|
61e6f0 |
pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%python_provide() %{lua:
|
|
|
61e6f0 |
function string.starts(String,Start)
|
|
|
61e6f0 |
return string.sub(String,1,string.len(Start))==Start
|
|
|
61e6f0 |
end
|
|
|
61e6f0 |
package = rpm.expand("%{?1}")
|
|
|
61e6f0 |
vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
|
|
|
61e6f0 |
if (string.starts(package, "python2-")) then
|
|
|
61e6f0 |
--No unversioned provides as python2 is not default
|
|
|
61e6f0 |
elseif (string.starts(package, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then
|
|
|
61e6f0 |
--No unversioned provides as python3 is not default
|
|
|
61e6f0 |
elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then
|
|
|
61e6f0 |
--No unversioned provides as python3_other is not default
|
|
|
61e6f0 |
elseif (string.starts(package, "pypy-")) then
|
|
|
61e6f0 |
--No unversioned provides as pypy is not default
|
|
|
61e6f0 |
elseif (string.starts(package, "pypy3-")) then
|
|
|
61e6f0 |
--No unversioned provides as pypy is not default
|
|
|
61e6f0 |
elseif (string.starts(package, "python-")) then
|
|
|
61e6f0 |
--Providing the current default python
|
|
|
61e6f0 |
print("Provides: python2-")
|
|
|
61e6f0 |
print(string.sub(package,8,string.len(package)))
|
|
|
61e6f0 |
print(" = ")
|
|
|
61e6f0 |
print(vr)
|
|
|
61e6f0 |
else
|
|
|
61e6f0 |
print("%python_provide: ERROR: ")
|
|
|
61e6f0 |
print(package)
|
|
|
61e6f0 |
print(" not recognized.")
|
|
|
61e6f0 |
end
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%python_enable_dependency_generator() \
|
|
|
61e6f0 |
%global __python_requires %{_rpmconfigdir}/pythondistdeps.py --requires \
|
|
|
61e6f0 |
%{nil}
|