mirror of
https://abf.rosa.ru/djam/python3.11.git
synced 2025-02-23 10:12:51 +00:00

* rm bytecompile macros which make no sense here because that macro exists in another place * py3 -> py311 in macros * add forgotten macro for the shebang sanity script
57 lines
3.2 KiB
Text
57 lines
3.2 KiB
Text
%__python311 /usr/libexec/python3.11
|
|
%python311_platform %(RPM_BUILD_ROOT= %{__python311} -Ic "import sysconfig; print(sysconfig.get_platform())")
|
|
%python311_platform %(RPM_BUILD_ROOT= %{__python311} -Ic "import sysconfig; print(sysconfig.get_platform())")
|
|
%python311_sitearch %(RPM_BUILD_ROOT= %{__python311} -Ic "import sysconfig; print(sysconfig.get_path('platlib', vars={'platbase': '%{_prefix}'}))")
|
|
%python311_sitelib %(RPM_BUILD_ROOT= %{__python311} -Ic "import sysconfig; print(sysconfig.get_path('purelib', vars={'base': '%{_prefix}'}))")
|
|
%python311_version %(RPM_BUILD_ROOT= %{__python311} -Ic "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
|
|
%python311_version_nodots %(RPM_BUILD_ROOT= %{__python311} -Ic "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
|
|
|
|
%py311_ver %(%{__python311} -c "import sys; v=sys.version_info[:2]; print('%%d.%%d'%%v)" 2>/dev/null || echo PYTHON-NOT-FOUND)
|
|
%py311_prefix %(%{__python311} -c "import sys; print(sys.prefix)" 2>/dev/null || echo PYTHON-NOT-FOUND)
|
|
%py311_platsitedir %python311_sitearch
|
|
%py311_puresitedir %python311_sitelib
|
|
%py311_incdir %(RPM_BUILD_ROOT= %{__python311} -c "import sysconfig; print(sysconfig.get_path('include', vars={'installed_base': '%{_prefix}'}))" 2>/dev/null || echo PYTHON-INCLUDEDIR-NOT-FOUND)
|
|
|
|
%py311_build() %{expand:\
|
|
CFLAGS="%{optflags} -lpython%{py311_ver}" %{__python311} %{py_setup} %{?py_setup_args} build --executable="%{__python311} %{py311_shbang_opts}" %{?*}\
|
|
}
|
|
|
|
%py311_install() %{expand:\
|
|
CFLAGS="%{optflags} -lpython%{py311_ver}" %{__python311} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}\
|
|
}
|
|
|
|
%py311_test() %{expand:\
|
|
%{__python311} %{py_setup} %{?py_setup_args} test %{?1}\
|
|
}
|
|
|
|
%py311_compile(O) \
|
|
find %1 -name '*.pyc' -exec rm -f {} \\; \
|
|
%{__python311} -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
|
|
%{-O: \
|
|
find %1 -name '*.pyo' -exec rm -f {} \\; \
|
|
%{__python311} -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
|
|
}
|
|
|
|
%py311_shbang_opts -s
|
|
%py311_shbang_opts_nodash %(opts=%{py311_shbang_opts}; echo ${opts#-})
|
|
%py311_shebang_flags %(opts=%{py311_shbang_opts}; echo ${opts#-})
|
|
%py311_shebang_fix %{_bindir}/pathfix3.11.py -pni %{__python311} %{py311_shebang_flags}}
|
|
|
|
%py311_install_egg() %{expand:\\\
|
|
mkdir -p %{buildroot}%{python311_sitelib}
|
|
%{__python311} -m easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python311_version}.egg %{?*}
|
|
rm -rfv %{buildroot}%{_bindir}/__pycache__
|
|
}
|
|
|
|
%py311_install_wheel() %{expand:\\\
|
|
%{__python311} -m pip install -I dist/%{1} --root %{buildroot} --no-deps --no-index --no-warn-script-location
|
|
rm -rfv %{buildroot}%{_bindir}/__pycache__
|
|
for distinfo in %{buildroot}%{python311_sitelib}/*.dist-info %{buildroot}%{python311_sitearch}/*.dist-info; do
|
|
if [ -f ${distinfo}/direct_url.json ]; then
|
|
rm -fv ${distinfo}/direct_url.json
|
|
sed -i '/direct_url.json/d' ${distinfo}/RECORD
|
|
fi
|
|
done
|
|
}
|
|
|
|
%py311_shebang_sanity %{_bindir}/python3.11-shebang-sanity
|