|
|
61e6f0 |
%__python3 /usr/libexec/platform-python
|
|
|
86545d |
%python3 %__python3
|
|
|
61e6f0 |
%python3_sitelib %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
|
|
|
61e6f0 |
%python3_sitearch %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
|
|
|
73059c |
%python3_version %(%{__python3} -Ic "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
|
|
|
73059c |
%python3_version_nodots %(%{__python3} -Ic "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info).replace('.',''))")
|
|
|
61e6f0 |
%python3_platform %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_platform())")
|
|
|
86545d |
%python3_platform_triplet %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))")
|
|
|
86545d |
%python3_ext_suffix %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
|
|
|
61e6f0 |
%py3dir %{_builddir}/python3-%{name}-%{version}-%{release}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%py3_shbang_opts -s
|
|
|
86545d |
%py3_shbang_opts_nodash %(opts=%{py3_shbang_opts}; echo ${opts#-})
|
|
|
86545d |
%py3_shebang_flags %(opts=%{py3_shbang_opts}; echo ${opts#-})
|
|
|
86545d |
%py3_shebang_fix %{expand:\\\
|
|
|
86545d |
if [ -f /usr/bin/pathfix%{python3_version}.py ]; then
|
|
|
86545d |
pathfix=/usr/bin/pathfix%{python3_version}.py
|
|
|
86545d |
else
|
|
|
86545d |
# unversioned pathfix.py provided by platform-python-devel
|
|
|
86545d |
pathfix=/usr/bin/pathfix.py
|
|
|
86545d |
fi
|
|
|
86545d |
if [ -z "%{?py3_shebang_flags}" ]; then
|
|
|
86545d |
shebang_flags="-k"
|
|
|
86545d |
else
|
|
|
86545d |
shebang_flags="-ka%{py3_shebang_flags}"
|
|
|
86545d |
fi
|
|
|
86545d |
$pathfix -pni %{__python3} $shebang_flags}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
# Use the slashes after expand so that the command starts on the same line as
|
|
|
61e6f0 |
# the macro
|
|
|
61e6f0 |
%py3_build() %{expand:\\\
|
|
|
61e6f0 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
61e6f0 |
%{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?*}
|
|
|
61e6f0 |
sleep 1
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%py3_build_egg() %{expand:\\\
|
|
|
61e6f0 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
61e6f0 |
%{__python3} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
|
|
|
61e6f0 |
sleep 1
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%py3_build_wheel() %{expand:\\\
|
|
|
61e6f0 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
61e6f0 |
%{__python3} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
|
|
|
61e6f0 |
sleep 1
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%py3_install() %{expand:\\\
|
|
|
61e6f0 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
61e6f0 |
%{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%py3_install_egg() %{expand:\\\
|
|
|
61e6f0 |
mkdir -p %{buildroot}%{python3_sitelib}
|
|
|
61e6f0 |
CFLAGS="%{optflags}" %{__python3} -m easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python3_version}.egg %{?*}
|
|
|
61e6f0 |
}
|
|
|
61e6f0 |
|
|
|
61e6f0 |
%py3_install_wheel() %{expand:\\\
|
|
|
61e6f0 |
CFLAGS="%{optflags}" %{__python3} -m pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
|
|
|
61e6f0 |
}
|
|
|
86545d |
|
|
|
86545d |
# This only supports Python 3.5+ and will never work with Python 2.
|
|
|
86545d |
# Hence, it has no Python version in the name.
|
|
|
86545d |
%pycached() %{lua:
|
|
|
86545d |
path = rpm.expand("%{?*}")
|
|
|
86545d |
if (string.sub(path, "-3") ~= ".py") then
|
|
|
86545d |
rpm.expand("%{error:%%pycached can only be used with paths explicitly ending with .py}")
|
|
|
86545d |
else
|
|
|
86545d |
print(path)
|
|
|
86545d |
pyminor = path:match("/python3.(%d+)/") or "*"
|
|
|
86545d |
dirname = path:match("(.*/)")
|
|
|
86545d |
modulename = path:match(".*/([^/]+).py")
|
|
|
86545d |
print("\\n" .. dirname .. "__pycache__/" .. modulename .. ".cpython-3" .. pyminor .. "{,.opt-?}.pyc")
|
|
|
86545d |
end
|
|
|
86545d |
}
|
|
|
86545d |
|
|
|
86545d |
# This is intended for Python 3 only, hence also no Python version in the name.
|
|
|
90be9a |
%__pytest /usr/bin/pytest-%{_python3_pkgversion_with_dot}
|
|
|
86545d |
%pytest %{expand:\\\
|
|
|
86545d |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
86545d |
PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
|
|
86545d |
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
|
|
|
86545d |
PYTHONDONTWRITEBYTECODE=1\\\
|
|
|
86545d |
%__pytest}
|