|
|
8d3d1dd |
%python3_sitelib %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
|
|
|
8d3d1dd |
%python3_sitearch %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
|
|
|
84ed1ab |
%python3_version %(%{__python3} -Ic "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
|
|
|
84ed1ab |
%python3_version_nodots %(%{__python3} -Ic "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
|
|
|
1ea9947 |
%python3_platform %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_platform())")
|
|
Orion Poplawski |
ec28c77 |
%py3dir %{_builddir}/python3-%{name}-%{version}-%{release}
|
|
Orion Poplawski |
ec28c77 |
|
|
Orion Poplawski |
ec28c77 |
%py3_shbang_opts -s
|
|
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 |
%py3_build() %{expand:\\\
|
|
|
4904408 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
4904408 |
%{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?*}
|
|
Orion Poplawski |
ec28c77 |
}
|
|
Orion Poplawski |
ec28c77 |
|
|
Orion Poplawski |
5ca1f52 |
%py3_build_egg() %{expand:\\\
|
|
|
4904408 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
4904408 |
%{__python3} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
|
|
Orion Poplawski |
e7af332 |
}
|
|
Orion Poplawski |
e7af332 |
|
|
Orion Poplawski |
5ca1f52 |
%py3_build_wheel() %{expand:\\\
|
|
|
4904408 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
4904408 |
%{__python3} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
|
|
Orion Poplawski |
f798c43 |
}
|
|
Orion Poplawski |
f798c43 |
|
|
Orion Poplawski |
5ca1f52 |
%py3_install() %{expand:\\\
|
|
|
4904408 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
4904408 |
%{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
|
|
|
2314fd9 |
rm -rfv %{buildroot}%{_bindir}/__pycache__
|
|
Orion Poplawski |
ec28c77 |
}
|
|
Orion Poplawski |
f798c43 |
|
|
Orion Poplawski |
5ca1f52 |
%py3_install_egg() %{expand:\\\
|
|
Orion Poplawski |
f798c43 |
mkdir -p %{buildroot}%{python3_sitelib}
|
|
Orion Poplawski |
f798c43 |
easy_install-%{python3_version} -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python3_version}.egg %{?*}
|
|
|
2314fd9 |
rm -rfv %{buildroot}%{_bindir}/__pycache__
|
|
Orion Poplawski |
f798c43 |
}
|
|
Orion Poplawski |
e7af332 |
|
|
Orion Poplawski |
5ca1f52 |
%py3_install_wheel() %{expand:\\\
|
|
|
f09ccd2 |
pip%{python3_version} install -I dist/%{1} --root %{buildroot} --no-deps
|
|
|
2314fd9 |
rm -rfv %{buildroot}%{_bindir}/__pycache__
|
|
Orion Poplawski |
a73eb24 |
}
|
|
|
6c63a5b |
|
|
|
6c63a5b |
# This only supports Python 3.5+ and will never work with Python 2.
|
|
|
6c63a5b |
# Hence, it has no Python version in the name.
|
|
|
6c63a5b |
%pycached() %{lua:
|
|
|
6c63a5b |
path = rpm.expand("%{?1}")
|
|
|
6c63a5b |
if (string.sub(path, "-3") ~= ".py") then
|
|
|
6c63a5b |
rpm.expand("%{error:%%pycached can only be used with paths explicitly ending with .py}")
|
|
|
6c63a5b |
else
|
|
|
6c63a5b |
print(path)
|
|
|
6c63a5b |
pyminor = path:match("/python3.(%d+)/") or "*"
|
|
|
6c63a5b |
dirname = path:match("(.*/)")
|
|
|
6c63a5b |
modulename = path:match(".*/([^/]+).py")
|
|
|
6c63a5b |
print("\\n" .. dirname .. "__pycache__/" .. modulename .. ".cpython-3" .. pyminor .. "{,.opt-?}.pyc")
|
|
|
6c63a5b |
end
|
|
|
6c63a5b |
}
|