diff --git a/macros.python b/macros.python index e52751bb96ac0fe2d14bed778994cb47a18ecd00..ce65c5242fe6d3f1aa0f592c86a8d3da0da37449 100644 --- a/macros.python +++ b/macros.python @@ -114,47 +114,7 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth %python_enable_dependency_generator() \ %global __pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires \ %{nil} -%__python2 /usr/bin/python2 -%python2_sitelib %(%{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())") -%python2_sitearch %(%{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") -%python2_version %(%{__python2} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))") -%python2_version_nodots %(%{__python2} -Esc "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))") -%py2_shbang_opts -s - -# Use the slashes after expand so that the command starts on the same line as -# the macro -%py2_build() %{expand:\\\ - CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ - %{__python2} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?*} - sleep 1 -} - -%py2_build_egg() %{expand:\\\ - CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ - %{__python2} %{py_setup} %{?py_setup_args} bdist_egg %{?*} - sleep 1 -} - -%py2_build_wheel() %{expand:\\\ - CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ - %{__python2} %{py_setup} %{?py_setup_args} bdist_wheel %{?*} - sleep 1 -} - -%py2_install() %{expand:\\\ - CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ - %{__python2} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} -} - -%py2_install_egg() %{expand:\\\ - mkdir -p %{buildroot}%{python2_sitelib} - easy_install-%{python2_version} -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python2_version}.egg %{?*} -} - -%py2_install_wheel() %{expand:\\\ - pip%{python2_version} install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps -} %__python3 /usr/bin/python3 %python3_sitelib %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib())") %python3_sitearch %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") @@ -228,26 +188,6 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth print(canonical);\ } -# Creates Python 2 dist tag(s) after converting names to canonical format -# Needs to first put all arguments into a list, because invoking a different -# macro (%py_dist_name) overwrites them -%py2_dist() %{lua:\ - args = {}\ - arg = 1\ - while (true) do\ - name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\ - if (name == nil or name == '') then\ - break\ - end\ - args[arg] = name\ - arg = arg + 1\ - end\ - for arg, name in ipairs(args) do\ - canonical = rpm.expand("%py_dist_name " .. name);\ - print("python2dist(" .. canonical .. ") ");\ - end\ -} - # Creates Python 3 dist tag(s) after converting names to canonical format # Needs to first put all arguments into a list, because invoking a different # macro (%py_dist_name) overwrites them @@ -300,7 +240,7 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth \ -- If no second argument, use %version if ver == '%2' then - ver = rpm.expand('%version') + ver = rpm.expand('%version'):gsub('~', '') end \ -- If no third argument, use the preset default extension @@ -314,10 +254,10 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth } # New python macros -%__python /usr/bin/python -%python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())") -%python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))") -%python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])") +%__python %__python3 +%python_sitelib %{python3_sitelib} +%python_sitearch %{python3_sitearch} +%python_version %{python3_version} # New python test macros %pytest() %{expand:\\\ diff --git a/openEuler-rpm-config.spec b/openEuler-rpm-config.spec index 4af8dae9c7e189b276f33f5e74d4b4968846b4ab..e7cfe70f51152cdf152bfd4831498bef303771d3 100644 --- a/openEuler-rpm-config.spec +++ b/openEuler-rpm-config.spec @@ -3,7 +3,7 @@ Name: %{vendor}-rpm-config Version: 31 -Release: 30 +Release: 31 License: GPL+ AND MIT Summary: specific rpm configuration files URL: https://gitee.com/src-openeuler/openEuler-rpm-config @@ -81,7 +81,6 @@ Source708: brp-llvm-compile-lto-elf Source800: common.lua Provides: python-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} -Provides: python2-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} Provides: python3-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} Provides: python-srpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} Provides: fpc-srpm-macros = 1.1-6 @@ -212,6 +211,11 @@ sed -i "s|@OSCPE@|$(cat /etc/system-release-cpe)|" %{buildroot}%{rpmvdir}/%{vend %{rpmvdir}/find-requires.ksyms %changelog +* Sat Aug 02 2025 Funda Wang - 31-31 +- let __python points to __python3, as we only provide one flavour of python now +- completely remove python2 only macros +- update pypi_source macro based on fedora + * Sat Jul 12 2025 Funda Wang - 31-30 - update config.sub and config.guess to snapshot at 20250107