Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-rpm-macros for openSUSE:Factory checked in at 2022-09-17 20:08:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-rpm-macros (Old) and /work/SRC/openSUSE:Factory/.python-rpm-macros.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-rpm-macros" Sat Sep 17 20:08:16 2022 rev:45 rq:1003105 version:20220912.f91cae2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-rpm-macros/python-rpm-macros.changes 2022-08-19 17:53:18.299701298 +0200 +++ /work/SRC/openSUSE:Factory/.python-rpm-macros.new.2083/python-rpm-macros.changes 2022-09-17 20:08:21.692814434 +0200 @@ -1,0 +2,18 @@ +Tue Sep 13 06:11:03 UTC 2022 - mc...@cepl.eu + +- Update to version 20220912.f91cae2: + * fix double expanded compileall in %{$python_pyproject_install} + * forgotten '%' + +------------------------------------------------------------------- +Mon Sep 12 03:10:25 UTC 2022 - c...@bnavigator.de + +- Update to version 20220911.111e4c9: + * fix gh#openSUSE/python-rpm-macros#141: allow parameters in sections + * more compact alternative scriptlets without newline + * Update flavor sets in README + * Document flavored PEP517 macros + * flavorize pyproject macros + * Avoid to install incorrect PEP610 metadata + +------------------------------------------------------------------- Old: ---- python-rpm-macros-20220809.cf8a7b8.tar.xz New: ---- python-rpm-macros-20220912.f91cae2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-rpm-macros.spec ++++++ --- /var/tmp/diff_new_pack.NvXEES/_old 2022-09-17 20:08:22.664817239 +0200 +++ /var/tmp/diff_new_pack.NvXEES/_new 2022-09-17 20:08:22.668817250 +0200 @@ -17,7 +17,7 @@ Name: python-rpm-macros -Version: 20220809.cf8a7b8 +Version: 20220912.f91cae2 Release: 0 Summary: RPM macros for building of Python modules License: WTFPL ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.NvXEES/_old 2022-09-17 20:08:22.708817365 +0200 +++ /var/tmp/diff_new_pack.NvXEES/_new 2022-09-17 20:08:22.712817377 +0200 @@ -3,6 +3,6 @@ <param name="url">git://github.com/openSUSE/python-rpm-macros.git</param> <param name="changesrevision">80d37568d9732beb7fcc2cf27c5c08f9c01fade1</param></service><service name="tar_scm"> <param name="url">https://github.com/openSUSE/python-rpm-macros.git</param> - <param name="changesrevision">cf8a7b84646b89b3016b0fe4915a411845230a94</param></service></servicedata> + <param name="changesrevision">42f3a521c443117c8fe5cacd23efb82078619a68</param></service></servicedata> (No newline at EOF) ++++++ python-rpm-macros-20220809.cf8a7b8.tar.xz -> python-rpm-macros-20220912.f91cae2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20220809.cf8a7b8/README.md new/python-rpm-macros-20220912.f91cae2/README.md --- old/python-rpm-macros-20220809.cf8a7b8/README.md 2022-08-09 06:58:11.000000000 +0200 +++ new/python-rpm-macros-20220912.f91cae2/README.md 2022-09-13 05:04:19.000000000 +0200 @@ -10,8 +10,9 @@ ### Terminology __``<flavor>``__ is a kind of python interpreter. At this point, we recognize the following flavors: -`python2`, `python3`, `python36`, `python38` and `pypy3`. `python3` points to the default of -coinstallable flavors `python3<M>` where `<M>` is the minor version number. +`python2`, `python3`, `python38`, `python39`, `python310`, `python311` and `pypy3`. `python3` points to the default of +coinstallable flavors `python3<M>` where `<M>` is the minor version number. The default is +specified not by python-rpm-macros but by the obs project definition in `%primary_python`. The flavor is used as a prefix for all flavor-specific macros. Some macros are redefined with "short" flavor for compatibility @@ -27,6 +28,7 @@ - `/usr/bin/python2` - `/usr/bin/python3` - `/usr/bin/python3.8` +- `/usr/bin/python3.10` - ... __modname__ is the PyPI name, or, if the package in question is not on PyPI, the moniker that we @@ -60,7 +62,8 @@ To control the build set, you can either completely redefine `%pythons`, or exclude particular flavor(s) by defining __`%skip_<flavor>`__. For example, if you `%define skip_python2 1`, -then Python 2 will be excluded from the default build set. +then Python 2 will be excluded from the default build set. (Python 2 is not in the default +build set of Tumbleweed and SLE/Leap >= 15.4) Skip-macros are intended __for per-package use only__. Never define a skip-macro in prjconf or in any other sort of global config. Instead, redefine `%pythons`. @@ -148,7 +151,7 @@ #### Flavor expansion The following macros expand to command lists for all flavors and move around the distutils-generated -`build` directory so that you are never running a `python2` command with a python3-generated `build` +`build` directory so that you are never running a `python39` command with a python310-generated `build` and vice versa. ##### General command expansion macros @@ -168,9 +171,9 @@ expands to: ``` - python2 generatefile.py /usr/lib/python2.7/site-packages - python3.6 generatefile.py /usr/lib/python3.6/site-packages python3.8 generatefile.py /usr/lib/python3.8/site-packages + python3.9 generatefile.py /usr/lib/python3.9/site-packages + python3.10 generatefile.py /usr/lib/python3.10/site-packages ``` etc. (plus the moving around of the `build` directory in between). @@ -181,31 +184,33 @@ ```spec %{python_expand # expanded-body: - if [ ${python_flavor} = python38 ]; then - $python command-for-py-38-only - echo "We have version %{$python_version}, because we are in $python_flavor." - echo "%{$python_flavor} has not enough levels of expansion and %{python_flavor} is always the default." + if [ ${python_flavor} = python310 ]; then + $python command-for-py-310-only fi - if [ $python_ = python36_ ]; then - echo "This also works." + echo "We have version %{$python_version}, because we are in $python_flavor." + echo "Cannot use %{$python_flavor} because it has not enough levels of expansion." + echo "And %{python_flavor} is expanded early to the global default." + if [ $python_ = python310_ ]; then + echo "A suffix_ works as intended." fi } ``` - which expands to + which expands during the python39 flavor iteration to ```sh # (.. moving build dirs ..) - python_flavor=python36 + python_flavor=python39 # expanded-body: - if [ ${python_flavor} = python38 ]; then - python3.6 command-for-py-38-only - echo "We have version 3.6, because we are in python36_flavor." - echo "%{python36_flavor} has not enough levels of expansion and python38 is always the default." + if [ ${python_flavor} = python310 ]; then + python3.9 command-for-py-310-only fi - if [ python36_ = python36_ ]; then - echo "This also works." + echo "We have version 3.9, because we are in python39_flavor." + echo "Cannot use %{python39_flavor} because it has not enough levels of expansion." + echo "And python310 is expanded early to the global default." + if [ python39_ = python310_ ]; then + echo "A suffix_ works as intended." fi ``` @@ -213,14 +218,12 @@ ##### Install macros -* __`%python_build`__ expands to distutils/setuptools build instructions for all flavors. - -* __`%python_install`__ expands to distutils/setuptools install instructions for all flavors. - * __`%pyproject_wheel`__ expands to [PEP517](https://www.python.org/dev/peps/pep-0517)/[PEP518](https://www.python.org/dev/peps/pep-0518/) - build instructions for all flavors, creates wheels and places them into the flavor's `build/` directories. - This is useful if the package has a ``pyproject.toml`` file but no ``setup.py``. + build instructions for all flavors, creates wheels and places them into the flavor's `./build/` directories + (specified by `%_pyproject_wheeldir`). In case of pure wheels only one wheel is created by the first flavor, + placed into `./dist/` (`%_pyproject_anywheeldir`) and copied over to `%_pyproject_wheeldir` for all other + flavors. * __`%pyproject_install [wheelfile]`__ expands to install instructions for all flavors to install the created wheels. You can also use this without `%pyproject_wheel`, if you place a pre-existing wheel into the current working dir @@ -232,6 +235,12 @@ newer flavors generate `__pycache__` directories. Use this if you have modified the source files in `%buildroot` after `%python_install` or `%pyproject_install` has compiled the files the first time. +* __`%python_build`__ expands to distutils/setuptools build instructions for all flavors using `setup.py`. + +* __`%python_install`__ expands to legacy distutils/setuptools install instructions for all flavors using `setup.py`. + Note that `python setup.py install` has been deprecated by setuptools and distutils is deprecated entirely. + Consider using the PEP517 install procedure using the `%pyproject_*` macros if the package sources support it. + * __`%python_clone filename`__ creates a copy of `filename` under a flavor-specific name for every flavor. This is useful for packages that install unversioned executables: `/usr/bin/foo` is copied to `/usr/bin/foo-%{python_bin_suffix}` for all flavors, and the shebang is modified accordingly. @@ -367,9 +376,13 @@ * __`%__<flavor>`__: path to the ``<flavor>`` executable. -* __`%<flavor>_build`__ expands to build instructions for the particular flavor. +* __`%<flavor>_pyproject_wheel`__ expands to PEP517 instructions to build a wheel using the particular flavor. + +* __`%<flavor>_pyproject_install`__ expands to PEP517 install instructions for the particular flavor. + +* __`%<flavor>_build`__ expands to `setup.py` build instructions for the particular flavor. -* __`%<flavor>_install`__ expands to install instructions for the particular flavor. +* __`%<flavor>_install`__ expands to legacy `setup.py` install instructions for the particular flavor. * __`%<flavor>_sitelib`, `%<flavor>_sitearch`__: path to noarch and arch-dependent `site-packages` directory. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20220809.cf8a7b8/flavor.in new/python-rpm-macros-20220912.f91cae2/flavor.in --- old/python-rpm-macros-20220809.cf8a7b8/flavor.in 2022-08-09 06:58:11.000000000 +0200 +++ new/python-rpm-macros-20220912.f91cae2/flavor.in 2022-09-13 05:04:19.000000000 +0200 @@ -41,6 +41,56 @@ %__#FLAVOR# %{py_setup} %{?py_setup_args} install \\\ -O1 --skip-build --force --root %{buildroot} --prefix %{_prefix} +##### PEP517/PEP518 macros ##### + +%#FLAVOR#_pyproject_wheel(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) \ +%{_python_use_flavor #FLAVOR#} \ +myargs="%{**}" \ +if [ -f %{_pyproject_anywheeldir}/*-none-any.whl ]; then \ + echo "Already found a compatible wheel in %{_pyproject_anywheeldir}" \ + mkdir -p %{_pyproject_wheeldir} \ + cp %{_pyproject_anywheeldir}/*-none-any.whl %{_pyproject_wheeldir}/ \ +else \ + %__#FLAVOR# -mpip wheel %{pyproject_wheel_args} ${myargs:-.}\ + if [ -f %{_pyproject_wheeldir}/*-none-any.whl ]; then \ + mkdir -p %{_pyproject_anywheeldir} \ + cp %{_pyproject_wheeldir}/*-none-any.whl %{_pyproject_anywheeldir}/ \ + fi \ +fi + +%#FLAVOR#_pyproject_install(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) \ +%{_python_use_flavor #FLAVOR#} \ +myargs="%{**}" \ +havereq=0 \ +if [ -n "${myargs}" ]; then \ + for a in ${myargs}; do \ + pep440req=$(echo $(basename -- ${a}) | sed -E 's/([^-]+)-([^-]+)-.+\\.whl/\\1==\\2/') \ + if [ -f ${a} -a $(basename -- ${a}) != "${pep440req}" ]; then \ + myargs=$(echo ${myargs} | sed "s|${a}|${pep440req}|") \ + mkdir -p %{_pyproject_wheeldir} \ + cp $a %{_pyproject_wheeldir} \ + havereq=1 \ + fi \ + done \ +fi \ +if [ $havereq -eq 0 ]; then \ + # Fallback for old macro usages which expect a wheel in the current directory \ + ls %{_pyproject_wheeldir}/*.whl || (mkdir -p %{_pyproject_wheeldir}/; cp *.whl %{_pyproject_wheeldir}/) \ + for w in %{_pyproject_wheeldir}/*.whl; do \ + myargs="$myargs $(echo $(basename ${w}) | sed -E 's/([^-]+)-([^-]+)-.+\\.whl/\\1==\\2/')" \ + done \ +fi \ +%__#FLAVOR# -mpip install %{pyproject_install_args} $myargs \ +for d in %{buildroot}%{#FLAVOR#_sitelib} %{buildroot}%{#FLAVOR#_sitearch}; do \ + if [ -d $d ]; then \ + find $d -name '*.pyc' -delete \ + %__#FLAVOR# -m compileall $d \ + %__#FLAVOR# -O -m compileall $d \ + fi \ +done + +# Alternative entries in file section + %#FLAVOR#_alternative() %{_python_macro_init} \ %{lua:local link, name, path = python_alternative_names(rpm.expand("%1"), rpm.expand("%#FLAVOR#_bin_suffix")) \ local libalternatives = rpm.expand("%{with libalternatives}") \ @@ -59,29 +109,17 @@ end \ } -# Commands for RPM scriptlets: These must not be empty even if there is no op for -# either update-alternatives or libalternatives +# Commands for RPM scriptlets: These must not be empty even if there is no operation for +# either update-alternatives or libalternatives. %#FLAVOR#_install_alternative() \# #FLAVOR#_install_alternative: \ -%if ! %{with libalternatives} \ -%{_python_macro_init} %{lua:python_install_ualternative("#FLAVOR#")} \\\ -%else \ -: \# no install scriptlet action for libalternatives \ -%endif \ -%{nil} +%{?!with_libalternatives:%{_python_macro_init}%{lua:python_install_ualternative("#FLAVOR#") \ +}}%{?with_libalternatives:\: \# no install scriptlet action for libalternatives} %#FLAVOR#_uninstall_alternative() \# #FLAVOR#_uninstall_alternative: \ -%if ! %{with libalternatives} \ -%{uninstall_alternative -n %1 -t %{_bindir}/%1-%#FLAVOR#_bin_suffix} \ -%else \ -: \# no uninstall scriptlet action for libalternatives \ -%endif \ -%{nil} +%{?!with_libalternatives:%{uninstall_alternative -n %1 -t %{_bindir}/%1-%{#FLAVOR#_bin_suffix} \ +}}%{?with_libalternatives:\: \# no uninstall scriptlet action for libalternatives} %#FLAVOR#_reset_alternative() \# #FLAVOR#_reset_alternative: \ -%if %{with libalternatives} \ -%{reset_alternative -n %1 -t %{_bindir}/%1-%#FLAVOR#_bin_suffix} \ -%else \ -: \# reset action only for libalternatives \ -%endif \ -%{nil} +%{?!with_libalternatives:\: \# reset action only for libalternatives \ +}%{?with_libalternatives:%{reset_alternative -n %1 -t %{_bindir}/%1-%{#FLAVOR#_bin_suffix}}} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20220809.cf8a7b8/functions.lua new/python-rpm-macros-20220912.f91cae2/functions.lua --- old/python-rpm-macros-20220809.cf8a7b8/functions.lua 2022-08-09 06:58:11.000000000 +0200 +++ new/python-rpm-macros-20220912.f91cae2/functions.lua 2022-09-13 05:04:19.000000000 +0200 @@ -69,16 +69,6 @@ return name end -function pkgname_from_param(param) - if param == modname then - return "" - elseif param:startswith(modname .. "-") then - return param:sub(modname:len() + 2) - else - return "-n " .. param - end -end - -- alternative-related local bindir = rpm.expand("%{_bindir}") local mandir = rpm.expand("%{_mandir}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20220809.cf8a7b8/macros/010-common-defs new/python-rpm-macros-20220912.f91cae2/macros/010-common-defs --- old/python-rpm-macros-20220809.cf8a7b8/macros/010-common-defs 2022-08-09 06:58:11.000000000 +0200 +++ new/python-rpm-macros-20220912.f91cae2/macros/010-common-defs 2022-09-13 05:04:19.000000000 +0200 @@ -15,6 +15,26 @@ end } +# put wheels into python_expand shuffled wheeldir by default +%_pyproject_wheeldir ./build + +# put flavor-agnostic wheels into a common dir. Dist is the default destination of pytnon -m build +%_pyproject_anywheeldir ./dist + +%pyproject_wheel_args \\\ + --verbose --progress-bar off --disable-pip-version-check \\\ + %{?py_setup_args:--build-option %{py_setup_args}} \\\ + --use-pep517 --no-build-isolation \\\ + --no-deps \\\ + --wheel-dir %{_pyproject_wheeldir} + +%pyproject_install_args \\\ + --verbose --progress-bar off --disable-pip-version-check \\\ + --root %{buildroot} \\\ + --no-compile \\\ + --ignore-installed --no-deps \\\ + --no-index --find-links %{_pyproject_wheeldir} + ##### fedora compatibility ##### %py_setup setup.py @@ -150,35 +170,6 @@ print(rpm.expand(intro .. args .. "}")) \ } -##### PEP-518 macros ##### -%pyproject_wheel(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) %{lua:\ - local args = rpm.expand("%**"); \ - local pyexpandstart = "%{python_expand # \\n"; \ - local buildwheel = "$python -mpip wheel --no-deps %{?py_setup_args:--build-option %{py_setup_args}}"; \ - buildwheel = buildwheel .. " --disable-pip-version-check --use-pep517 --no-build-isolation --progress-bar off --verbose . -w build/ "; \ - -- remove abi and platform tags from filename in case the package does define them incorrectly (see PEP427 for valid filenames) \ - -- single percent for shell out of four percent by rpm.expand \ - local renamewheel = "fn=(build/*.whl); fn2=${fn%%%%-*-*.whl}-none-any.whl; if [ ! $fn -ef $fn2 ]; then mv $fn $fn2; fi"; \ - local pyexpandend = "}"; \ - print(rpm.expand(pyexpandstart .. buildwheel .. args .. "\\n " .. renamewheel .. pyexpandend)) \ -} - -# No such option: --strip-file-prefix %%{buildroot} -%pyproject_install(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) %{lua:\ - local args = rpm.expand("%**"); \ - local broot = rpm.expand("--root %buildroot"); \ - local pyexpandstart = "%{python_expand # \\n"; \ - local findwheel = "wheelinargs=0 \\n"; \ - if args ~= "" then \ - findwheel = findwheel .. "for a in " .. args .. "; do if [ -f $a -a ${a: -3} = 'whl' ]; then wheelinargs=1; break; fi; done \\n"; \ - end \ - findwheel = findwheel .. "if [ $wheelinargs -eq 0 ]; then if [ -f build/*.whl ]; then wheelname=build/*.whl; else wheelname=*.whl; fi; fi \\n"; \ - local installwheel = "$python -mpip install " .. broot .. " --ignore-installed --disable-pip-version-check --no-compile --no-deps --progress-bar off " .. args .. " $wheelname"; \ - local pyexpandend = "}"; \ - print(rpm.expand(pyexpandstart .. findwheel .. installwheel .. pyexpandend)) \ - print(rpm.expand("%python_compileall")) \ -} - ##### Precompile scripts macro ##### %python_compileall \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20220809.cf8a7b8/macros.lua new/python-rpm-macros-20220912.f91cae2/macros.lua --- old/python-rpm-macros-20220809.cf8a7b8/macros.lua 2022-08-09 06:58:11.000000000 +0200 +++ new/python-rpm-macros-20220912.f91cae2/macros.lua 2022-09-13 05:04:19.000000000 +0200 @@ -195,35 +195,30 @@ end end - local function files_headline(flavor, param) + local function section_headline(section, flavor, param) if not param then param = "" end - local append = param:match("(%-f%s+%S+)") - local nof = param:gsub("%-f%s+%S+%s*", "") - local python_files = param:match("%%{?python_files}?") - local subpkg = param:match("%%{python_files%s*(.-)}") - if subpkg then python_files = true end - - if is_called_python and not python_files then - -- kingly hack. but RPM's native %error does not work. - local errmsg = - 'error: Package with "python-" prefix must not contain unmarked "%files" sections.\n' .. - 'error: Use "%files %python_files" or "%files %{python_files foo} instead.\n' - io.stderr:write(errmsg) - print(errmsg) - error('Invalid spec file') + local subpkg = " " .. param; local flags = "" + for flag in subpkg:gmatch("(%s%-[flp]%s+%S+)") do + flags = flags .. flag end - - local mymodname = nof - if python_files then mymodname = subpkg end - return "%files -n " .. package_name(flavor, modname, mymodname, append) .. "\n" - end - - local function section_headline(section, flavor, param) + subpkg = subpkg:gsub("(%s%-[flp]%s+%S+)", "") + subpkg = subpkg:gsub("^%s*(.-)%s*$", "%1") if section == "files" then - return files_headline(flavor, param) - else - return "%" .. section .. " -n " .. package_name(flavor, modname, param) .. "\n" + local python_files = param:match("%%{?python_files}?") + local filessubpkg = param:match("%%{python_files%s*(.-)}") + if filessubpkg then python_files = true end + if is_called_python and not python_files then + -- kingly hack. but RPM's native %error does not work. + local errmsg = + 'error: Package with "python-" prefix must not contain unmarked "%files" sections.\n' .. + 'error: Use "%files %python_files" or "%files %{python_files foo} instead.\n' + io.stderr:write(errmsg) + print(errmsg) + error('Invalid spec file') + end + if python_files then subpkg = filessubpkg end end + return "%" .. section .. " -n " .. package_name(flavor, modname, subpkg, flags) .. "\n" end local python2_binsuffix = rpm.expand("%python2_bin_suffix") @@ -451,6 +446,20 @@ end end +function pyproject_wheel(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) + rpm.expand("%_python_macro_init") + for _, python in ipairs(pythons) do + print(rpm.expand("%" .. python .. "_pyproject_wheel %**")) + end +end + +function pyproject_install(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) + rpm.expand("%_python_macro_init") + for _, python in ipairs(pythons) do + print(rpm.expand("%" .. python .. "_pyproject_install %**")) + end +end + function python_files() rpm.expand("%_python_macro_init") local nparams = rpm.expand("%#")