From 318a36b4de88b8c3870c5fecd72b93f4d0a30cc388c88b019782d2538ca9de5e Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 21 Jul 2022 14:25:07 +0000 Subject: [PATCH 1/2] - Switch from %primary_interpreter to prjconf-defined %primary_python (gh#openSUSE/python-rpm-macros#127). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python310?expand=0&rev=46 --- python310.changes | 6 ++++++ python310.spec | 52 +++++++++++++++++++++-------------------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/python310.changes b/python310.changes index 57e429c..26c4492 100644 --- a/python310.changes +++ b/python310.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jul 21 14:19:52 UTC 2022 - Matej Cepl + +- Switch from %primary_interpreter to prjconf-defined + %primary_python (gh#openSUSE/python-rpm-macros#127). + ------------------------------------------------------------------- Thu Jun 9 16:43:30 UTC 2022 - Matej Cepl diff --git a/python310.spec b/python310.spec index 7f7da63..6d472aa 100644 --- a/python310.spec +++ b/python310.spec @@ -36,6 +36,8 @@ %bcond_without general %endif +%define python_pkg_name python310 + %if 0%{?sle_version} && 0%{?suse_version} < 1550 # Obsoleting previous "latest" Python versions # Next versions will get more lines like for older versions @@ -59,14 +61,6 @@ Obsoletes: python39%{?1:-%{1}} %else %define tarversion %{version} %endif -%define python_pkg_name python310 -# Will provide the python3-* provides -# Will do the /usr/bin/python3 and all the core links -%if 0%{?sle_version} || 0%{?suse_version} < 1550 -%define primary_interpreter 0 -%else -%define primary_interpreter 1 -%endif # We don't process beta signs well %define folderversion 3.10.5 %define tarname Python-%{tarversion} @@ -224,7 +218,7 @@ Recommends: %{python_pkg_name}-curses Recommends: %{python_pkg_name}-dbm Recommends: %{python_pkg_name}-pip %obsolete_python_versioned -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" Provides: python3 = %{python_version} %endif %endif @@ -247,7 +241,7 @@ development environment (python3-idle). Summary: TkInter, a Python Tk Interface Requires: %{python_pkg_name} = %{version} %obsolete_python_versioned tk -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" Provides: python3-tk = %{version} %endif @@ -258,7 +252,7 @@ Python interface to Tk. Tk is the GUI toolkit that comes with Tcl. Summary: Python Interface to the (N)Curses Library Requires: %{python_pkg_name} = %{version} %obsolete_python_versioned curses -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" Provides: python3-curses %endif @@ -270,7 +264,7 @@ Console User Interface. Summary: Python Interface to the GDBM Library Requires: %{python_pkg_name} = %{version} %obsolete_python_versioned dbm -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" Provides: python3-dbm %endif @@ -283,7 +277,7 @@ Summary: An Integrated Development Environment for Python Requires: %{python_pkg_name} = %{version} Requires: %{python_pkg_name}-tk %obsolete_python_versioned idle -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" Provides: python3-idle = %{version} %endif @@ -297,7 +291,7 @@ a debugger. Summary: Package Documentation for Python 3 Enhances: %{python_pkg_name} = %{python_version} %obsolete_python_versioned doc -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" Provides: python3-doc = %{version} %endif @@ -309,7 +303,7 @@ Python, and Macintosh Module Reference in HTML format. %package -n %{python_pkg_name}-doc-devhelp Summary: Additional Package Documentation for Python 3 in devhelp format %obsolete_python_versioned doc-devhelp -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" Provides: python3-doc-devhelp = %{version} %endif @@ -336,7 +330,7 @@ Provides: %{python_pkg_name}-typing = %{version} %obsolete_python_versioned typing # python3-xml was merged into python3, now moved into -base Provides: %{python_pkg_name}-xml = %{version} -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" Provides: python3-asyncio = %{version} Obsoletes: python3-asyncio < %{version} Provides: python3-base = %{version} @@ -364,7 +358,7 @@ Requires: %{python_pkg_name}-base = %{version} Provides: %{python_pkg_name}-2to3 = %{version} Provides: %{python_pkg_name}-demo = %{version} %obsolete_python_versioned tools -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" Provides: python3-2to3 = %{version} Provides: python3-demo = %{version} Provides: python3-tools = %{version} @@ -380,7 +374,7 @@ and a set of demonstration programs. Summary: Include Files and Libraries Mandatory for Building Python Modules Requires: %{python_pkg_name}-base = %{version} %obsolete_python_versioned devel -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" Provides: python3-devel = %{version} %endif @@ -400,7 +394,7 @@ Summary: Unit tests for Python and its standard library Requires: %{python_pkg_name} = %{version} Requires: %{python_pkg_name}-tk = %{version} %obsolete_python_versioned testsuite -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" Provides: python3-testsuite = %{version} %endif @@ -443,7 +437,7 @@ other applications. # drop Autoconf version requirement sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" # fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to /usr/bin/python3 for dir in Lib Tools; do # find *.py, filter to files that contain bad shebangs @@ -696,7 +690,7 @@ rm -fv %{buildroot}%{dynlib nis} ln -sf python%{python_version} %{buildroot}%{_bindir}/python3 # decide to ship python3 or just python3.X -%if !%{primary_interpreter} +%if "%{python_pkg_name}" != "%{primary_python}" # base rm %{buildroot}%{_bindir}/python3 rm %{buildroot}%{_bindir}/pydoc3 @@ -714,7 +708,7 @@ ln -s ../../libpython%{python_abi}.so %{buildroot}%{_libdir}/python%{python_vers rm %{buildroot}%{_bindir}/idle3* # delete the generic 2to3 binary if we are not primary -%if !%{primary_interpreter} +%if "%{python_pkg_name}" != "%{primary_python}" rm %{buildroot}%{_bindir}/2to3 %endif @@ -744,7 +738,7 @@ install -m 755 -D Tools/gdb/libpython.py %{buildroot}%{_datadir}/gdb/auto-load/% #cp Makefile Makefile.pre.in Makefile.pre $RPM_BUILD_ROOT%{sitedir}/config-%{python_abi}/ # RPM macros -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d/ install -m 644 %{SOURCE7} %{buildroot}%{_rpmconfigdir}/macros.d/ # macros.python3 %endif @@ -846,7 +840,7 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo %files -n %{python_pkg_name}-tools %defattr(644, root, root, 755) %{sitedir}/turtledemo -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" %{_bindir}/2to3 %endif %attr(755, root, root)%{_bindir}/2to3-%{python_version} @@ -855,7 +849,7 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo %files -n %{python_pkg_name}-devel %defattr(644, root, root, 755) %{_libdir}/libpython%{python_abi}.so -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" %{_libdir}/libpython3.so %endif %{_libdir}/pkgconfig/* @@ -863,7 +857,7 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo %{sitedir}/config-%{python_abi}-* %defattr(755, root, root) %{_bindir}/python%{python_abi}-config -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" %{_bindir}/python3-config %endif # Own these directories to not depend on gdb @@ -896,14 +890,14 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo %doc %{_docdir}/%{name}/README.rst %license LICENSE %doc %{_docdir}/%{name}/README.SUSE -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" %{_mandir}/man1/python3.1%{?ext_man} %endif %{_mandir}/man1/python%{python_version}.1%{?ext_man} # license text, not a doc because the code can use it at run-time %{sitedir}/LICENSE.txt # RPM macros -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" %{_rpmconfigdir}/macros.d/macros.python3 %endif # binary parts @@ -1008,7 +1002,7 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo %{sitedir}/_import_failed %{sitedir}/site-packages/zzzz-import-failed-hooks.pth # symlinks -%if %{primary_interpreter} +%if "%{python_pkg_name}" == "%{primary_python}" %{_bindir}/python3 %{_bindir}/pydoc3 %endif From d852af53f474345128afe51ba552bb6aa899e58ecd912e1565bbdab459ef2172 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 21 Jul 2022 15:15:23 +0000 Subject: [PATCH 2/2] Restore %primary_interpreter OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python310?expand=0&rev=47 --- python310.spec | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/python310.spec b/python310.spec index 6d472aa..90b3d75 100644 --- a/python310.spec +++ b/python310.spec @@ -37,6 +37,11 @@ %endif %define python_pkg_name python310 +%if "%{python_pkg_name}" == "%{primary_python}" +%define primary_interpreter 1 +%else +%define primary_interpreter 0 +%endif %if 0%{?sle_version} && 0%{?suse_version} < 1550 # Obsoleting previous "latest" Python versions @@ -218,7 +223,7 @@ Recommends: %{python_pkg_name}-curses Recommends: %{python_pkg_name}-dbm Recommends: %{python_pkg_name}-pip %obsolete_python_versioned -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} Provides: python3 = %{python_version} %endif %endif @@ -241,7 +246,7 @@ development environment (python3-idle). Summary: TkInter, a Python Tk Interface Requires: %{python_pkg_name} = %{version} %obsolete_python_versioned tk -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} Provides: python3-tk = %{version} %endif @@ -252,7 +257,7 @@ Python interface to Tk. Tk is the GUI toolkit that comes with Tcl. Summary: Python Interface to the (N)Curses Library Requires: %{python_pkg_name} = %{version} %obsolete_python_versioned curses -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} Provides: python3-curses %endif @@ -264,7 +269,7 @@ Console User Interface. Summary: Python Interface to the GDBM Library Requires: %{python_pkg_name} = %{version} %obsolete_python_versioned dbm -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} Provides: python3-dbm %endif @@ -277,7 +282,7 @@ Summary: An Integrated Development Environment for Python Requires: %{python_pkg_name} = %{version} Requires: %{python_pkg_name}-tk %obsolete_python_versioned idle -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} Provides: python3-idle = %{version} %endif @@ -291,7 +296,7 @@ a debugger. Summary: Package Documentation for Python 3 Enhances: %{python_pkg_name} = %{python_version} %obsolete_python_versioned doc -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} Provides: python3-doc = %{version} %endif @@ -303,7 +308,7 @@ Python, and Macintosh Module Reference in HTML format. %package -n %{python_pkg_name}-doc-devhelp Summary: Additional Package Documentation for Python 3 in devhelp format %obsolete_python_versioned doc-devhelp -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} Provides: python3-doc-devhelp = %{version} %endif @@ -330,7 +335,7 @@ Provides: %{python_pkg_name}-typing = %{version} %obsolete_python_versioned typing # python3-xml was merged into python3, now moved into -base Provides: %{python_pkg_name}-xml = %{version} -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} Provides: python3-asyncio = %{version} Obsoletes: python3-asyncio < %{version} Provides: python3-base = %{version} @@ -358,7 +363,7 @@ Requires: %{python_pkg_name}-base = %{version} Provides: %{python_pkg_name}-2to3 = %{version} Provides: %{python_pkg_name}-demo = %{version} %obsolete_python_versioned tools -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} Provides: python3-2to3 = %{version} Provides: python3-demo = %{version} Provides: python3-tools = %{version} @@ -374,7 +379,7 @@ and a set of demonstration programs. Summary: Include Files and Libraries Mandatory for Building Python Modules Requires: %{python_pkg_name}-base = %{version} %obsolete_python_versioned devel -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} Provides: python3-devel = %{version} %endif @@ -394,7 +399,7 @@ Summary: Unit tests for Python and its standard library Requires: %{python_pkg_name} = %{version} Requires: %{python_pkg_name}-tk = %{version} %obsolete_python_versioned testsuite -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} Provides: python3-testsuite = %{version} %endif @@ -437,7 +442,7 @@ other applications. # drop Autoconf version requirement sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} # fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to /usr/bin/python3 for dir in Lib Tools; do # find *.py, filter to files that contain bad shebangs @@ -690,7 +695,7 @@ rm -fv %{buildroot}%{dynlib nis} ln -sf python%{python_version} %{buildroot}%{_bindir}/python3 # decide to ship python3 or just python3.X -%if "%{python_pkg_name}" != "%{primary_python}" +%if !%{primary_interpreter} # base rm %{buildroot}%{_bindir}/python3 rm %{buildroot}%{_bindir}/pydoc3 @@ -708,7 +713,7 @@ ln -s ../../libpython%{python_abi}.so %{buildroot}%{_libdir}/python%{python_vers rm %{buildroot}%{_bindir}/idle3* # delete the generic 2to3 binary if we are not primary -%if "%{python_pkg_name}" != "%{primary_python}" +%if !%{primary_interpreter} rm %{buildroot}%{_bindir}/2to3 %endif @@ -738,7 +743,7 @@ install -m 755 -D Tools/gdb/libpython.py %{buildroot}%{_datadir}/gdb/auto-load/% #cp Makefile Makefile.pre.in Makefile.pre $RPM_BUILD_ROOT%{sitedir}/config-%{python_abi}/ # RPM macros -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d/ install -m 644 %{SOURCE7} %{buildroot}%{_rpmconfigdir}/macros.d/ # macros.python3 %endif @@ -840,7 +845,7 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo %files -n %{python_pkg_name}-tools %defattr(644, root, root, 755) %{sitedir}/turtledemo -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} %{_bindir}/2to3 %endif %attr(755, root, root)%{_bindir}/2to3-%{python_version} @@ -849,7 +854,7 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo %files -n %{python_pkg_name}-devel %defattr(644, root, root, 755) %{_libdir}/libpython%{python_abi}.so -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} %{_libdir}/libpython3.so %endif %{_libdir}/pkgconfig/* @@ -857,7 +862,7 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo %{sitedir}/config-%{python_abi}-* %defattr(755, root, root) %{_bindir}/python%{python_abi}-config -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} %{_bindir}/python3-config %endif # Own these directories to not depend on gdb @@ -890,14 +895,14 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo %doc %{_docdir}/%{name}/README.rst %license LICENSE %doc %{_docdir}/%{name}/README.SUSE -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} %{_mandir}/man1/python3.1%{?ext_man} %endif %{_mandir}/man1/python%{python_version}.1%{?ext_man} # license text, not a doc because the code can use it at run-time %{sitedir}/LICENSE.txt # RPM macros -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} %{_rpmconfigdir}/macros.d/macros.python3 %endif # binary parts @@ -1002,7 +1007,7 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo %{sitedir}/_import_failed %{sitedir}/site-packages/zzzz-import-failed-hooks.pth # symlinks -%if "%{python_pkg_name}" == "%{primary_python}" +%if %{primary_interpreter} %{_bindir}/python3 %{_bindir}/pydoc3 %endif