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 2021-02-02 14:24:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-rpm-macros (Old) and /work/SRC/openSUSE:Factory/.python-rpm-macros.new.28504 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-rpm-macros" Tue Feb 2 14:24:32 2021 rev:34 rq:868221 version:20210131.ec7577b Changes: -------- --- /work/SRC/openSUSE:Factory/python-rpm-macros/python-rpm-macros.changes 2021-01-15 19:42:57.349714070 +0100 +++ /work/SRC/openSUSE:Factory/.python-rpm-macros.new.28504/python-rpm-macros.changes 2021-02-02 14:24:40.343298565 +0100 @@ -1,0 +2,47 @@ +Sun Jan 31 20:38:20 UTC 2021 - mc...@cepl.eu + +- Update to version 20210131.ec7577b: + * remove old commented path finding section + * expand python_subpackage_only not earlier than in python_subpackages call + * make the path and var macros return a non-interrupted string even when the flavor is not installed + +------------------------------------------------------------------- +Sun Jan 31 13:31:40 UTC 2021 - mc...@cepl.eu + +- Update to version 20210131.1450767: + * only add parentheses when boolean operators are used + * sync buildset definitions with Factory + * fix typo + +------------------------------------------------------------------- +Wed Jan 27 22:48:28 UTC 2021 - mc...@cepl.eu + +- Update to version 20210127.3a18043: + * dont't rename wheel when it already has the same name + +------------------------------------------------------------------- +Tue Jan 26 21:11:34 UTC 2021 - mc...@cepl.eu + +- Update to version 20210126.fea1c1f: + * Document python_module with boolean dependecies + * workaround undetected abi and platform tags gh#openSUSE/python-rpm-macros#93 + +------------------------------------------------------------------- +Thu Jan 21 11:10:22 UTC 2021 - mc...@cepl.eu + +- Update to version 20210121.ef5b8b9: + * Add %python pseudo-macro for %python_modules -- server and rpm version + +------------------------------------------------------------------- +Sun Jan 17 07:07:30 UTC 2021 - mc...@cepl.eu + +- Update to version 20210117.63cf413: + * improve flavor variable naming in python_expand + +------------------------------------------------------------------- +Sat Jan 16 12:29:33 UTC 2021 - mc...@cepl.eu + +- Update to version 20210116.2682657: + * remove python2 not found error + +------------------------------------------------------------------- Old: ---- python-rpm-macros-20210112.86f4d9d.tar.xz New: ---- python-rpm-macros-20210131.ec7577b.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-rpm-macros.spec ++++++ --- /var/tmp/diff_new_pack.sJmvDz/_old 2021-02-02 14:24:41.035299641 +0100 +++ /var/tmp/diff_new_pack.sJmvDz/_new 2021-02-02 14:24:41.035299641 +0100 @@ -17,7 +17,7 @@ Name: python-rpm-macros -Version: 20210112.86f4d9d +Version: 20210131.ec7577b Release: 0 Summary: RPM macros for building of Python modules License: WTFPL ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.sJmvDz/_old 2021-02-02 14:24:41.083299716 +0100 +++ /var/tmp/diff_new_pack.sJmvDz/_new 2021-02-02 14:24:41.087299722 +0100 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/openSUSE/python-rpm-macros.git</param> - <param name="changesrevision">16d3497aadc60ea99a1e28894b8d9bd073ac3e29</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">296eb32e76011293f6949392aec8c12c63febdc9</param></service></servicedata> \ No newline at end of file ++++++ python-rpm-macros-20210112.86f4d9d.tar.xz -> python-rpm-macros-20210131.ec7577b.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210112.86f4d9d/README.md new/python-rpm-macros-20210131.ec7577b/README.md --- old/python-rpm-macros-20210112.86f4d9d/README.md 2021-01-12 08:17:34.000000000 +0100 +++ new/python-rpm-macros-20210131.ec7577b/README.md 2021-01-31 21:37:58.000000000 +0100 @@ -77,7 +77,7 @@ * __`%pythons`__ - the build set. See above for details. -* __`%have_<flavor`__. Defined as 1 if the flavor is present in the build environment. +* __`%have_<flavor>`__. Defined as 1 if the flavor is present in the build environment. Undefined otherwise. _Note:_ "present in build environment" does not mean "part of build set". Under some @@ -90,8 +90,13 @@ _Note:_ You do not need to define `%skip_python2` for Tumbleweed. Only define, if you need to skip it for older distributions. -* __`%{python_module modname [= version]}`__ expands to `<flavor>-modname [= version]` for every -flavor. Intended as: `BuildRequires: %{python_module foo}`. +* __`%{python_module modname args}`__ expands to `(<flavor>-modname args)` for every + flavor. Intended as: `BuildRequires: %{python_module foo >= version}`. Supports + [rpm boolean dependencies](https://rpm.org/user_doc/boolean_dependencies.html). + If the package needs a module only for a specific Python version, you can use the special pseudo-macro + `%python` for expansion of the python-flavor within the requirement, e.g. + `BuildRequires: %{python_module python-aiocontextvars >= 0.2.2 if %python-base < 3.7}`. + (Don't define `%python` anywhere else.) * __`%{python_dist_name modname}`__. Given a standardized name (i.e. dist name, name on PyPI) of `modname`, it will convert it to a canonical format. @@ -104,9 +109,10 @@ it will convert it to a canonical format, and evaluates to python3.Ydist(CANONICAL_NAME), which is useful when listing dependencies. Intended as `(Build)Requires: %{python3_dist foo}`. -* __`%python_flavor`__ expands to the `%pythons` entry that is currently being processed. +* __`%python_flavor`__ expands to the `%pythons` entry that is currently being processed. Does not apply in `%prep`, `%build`, `%install` and `%check` sections. For those, check for the -expansion of `$python_` inside the `%python_expand` macro (see below). +pseudo-shell variable expansion of `$python` and `$python_flavor` inside the `%python_expand` macro +(see [Flavor expansion](#flavor-expansion)). * __`%python_subpackages`__ expands to the autogenerated subpackages. This should go at the end of the main headers section. @@ -131,7 +137,7 @@ * __`%if<flavor>`__: applies the following section only to subpackages of that particular flavor. * __`%ifpycache`__: applies the following section only to subpackages of flavors that generate a -`__pycache__` directory. +`__pycache__` directory. * __`%<flavor>_only`__: applies the contents of the line only to subpackages of that particular flavor. @@ -154,27 +160,34 @@ of its arguments for every flavor. Importantly, `$python` is not expanded by the shell, but replaced beforehand for the current flavor, even in macros: - - When used as command delimited by space or one of `"'\)&|;<>`, it is replaced by the path to the executable + - When used as command delimited by space or one of `"'\)&|;<>`, it is replaced by the path to the executable. - When used as part of a macro name or other string, it is replaced by the current flavor name. So: - `%{python_expand $python generatefile.py %{$python_bin_suffix}}` + `%python_expand $python generatefile.py %{$python_sitelib}` expands to: ``` - python2 generatefile.py 2.7 - python3.6 generatefile.py 3.6 - python3.8 generatefile.py 3.8 + 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 ``` etc. (plus the moving around of the `build` directory in between). - If you want to check for the current python flavor inside `%python_expand` use something like + If you want to check for the current python flavor inside `%python_expand`, either use the shell variale + `${python_flavor}` (not `$python_flavor`, `%{python_flavor}` or `%{$python_flavor}`), or append a suffix, + which is not one of the recognized delimiters listed above: ```spec - %{python_expand # + %{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." + fi if [ $python_ = python36_ ]; then - $python command-for-py-36-only (we have %{$python_version}) + echo "This also works." fi } ``` @@ -182,9 +195,17 @@ which expands to ```sh - # - if [ python38_ = python36_ ]; then - python3.8 command-for-py-36-only (we have 3.8) + # (.. moving build dirs ..) + python_flavor=python36 + + # 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." + fi + if [ python36_ = python36_ ]; then + echo "This also works." fi ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210112.86f4d9d/buildset.in new/python-rpm-macros-20210131.ec7577b/buildset.in --- old/python-rpm-macros-20210112.86f4d9d/buildset.in 2021-01-12 08:17:34.000000000 +0100 +++ new/python-rpm-macros-20210131.ec7577b/buildset.in 2021-01-31 21:37:58.000000000 +0100 @@ -1,9 +1,20 @@ +# buildset.in: prjconf definitions for python-rpm-macros. +# +# This is usually overridden by the distribution's prjconf, landing in ~/.rpmmacros. +# This file provides the default definition from Factory (Tumbleweed) for pure rpmbuild packaging. -# This method for generating python_modules gets too deep to expand at about 5 python flavors. -# It is replaced by a Lua macro in macros.lua -# However, OBS has a much higher expansion depth, so this works fine. -%python_module_iter(a:) %{-a*}-%{args} %{expand:%%{?!python_module_iter_%1:%%{python_module_iter -a %*}}} -%python_module_iter_STOP stop -%python_module() %{expand:%%define args %{**}} %{expand:%%{python_module_iter -a %{pythons} STOP}} +# order of %pythons is important: The last flavor overrides any operation on conflicting files and definitions during expansions, +# making it the "default" in many cases --> keep the primary python3 provider at the end. +%pythons %{?!skip_python3:%{?!skip_python36:python36} %{?!skip_python38:python38}} +%skip_python2 1 +%_without_python2 1 + +# This method for generating python_modules gets too deep to expand for rpm at about 5 python flavors. +# Hence, python_module_iter is replaced by python_module_lua in macros.lua. +# However, OBS cannot expand lua, but has a much higher expansion depth, so this works fine for the server side resolver. +%python_module_iter(a:) %{expand:%%define python %{-a*}} ( %python-%args ) %{expand:%%{?!python_module_iter_%1:%%{python_module_iter -a%*}}%%{?python_module_iter_%1}} +# pseudo-undefine for obs: reset for the next expansion within the next call of python_module +%python_module_iter_STOP %global python %%%%python +%python_module() %{?!python_module_lua:%{expand:%%define args %{**}} %{expand:%%{python_module_iter -a %{pythons} STOP}}}%{?python_module_lua:%python_module_lua %{**}} %add_python() %{expand:%%define pythons %pythons %1} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210112.86f4d9d/compile-macros.sh new/python-rpm-macros-20210131.ec7577b/compile-macros.sh --- old/python-rpm-macros-20210112.86f4d9d/compile-macros.sh 2021-01-12 08:17:34.000000000 +0100 +++ new/python-rpm-macros-20210131.ec7577b/compile-macros.sh 2021-01-31 21:37:58.000000000 +0100 @@ -1,11 +1,8 @@ #!/bin/bash -FLAVORS="python2 python3 python36 python38 pypy3" - -# order of BUILDSET is important, it is copied to order of %pythons, -# and that determines the last installed binary -BUILDSET="python2 python3 python36 python38" - +# The set of flavors for which we produce macros. Not identical to +# the buildset predefined for specific distributions (see below) +FLAVORS="python2 python3 python36 python38 python39 pypy3" ### flavor-specific: generate from flavor.in for flavor in $FLAVORS; do @@ -17,13 +14,9 @@ done -### buildset: generate %pythons, %skip_python? and %python_modules -pythons="" -for flavor in $BUILDSET; do - pythons="${pythons} %{?!skip_$flavor:$flavor}" -done -echo "%pythons $pythons" > macros/040-buildset -cat buildset.in >> macros/040-buildset +### buildset: %pythons, %python_module and %add_python, usually overidden +# by the distribution's prjconf +cat buildset.in > macros/040-buildset ### Lua: generate automagic from macros.in and macros.lua diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210112.86f4d9d/macros/010-common-defs new/python-rpm-macros-20210131.ec7577b/macros/010-common-defs --- old/python-rpm-macros-20210112.86f4d9d/macros/010-common-defs 2021-01-12 08:17:34.000000000 +0100 +++ new/python-rpm-macros-20210131.ec7577b/macros/010-common-defs 2021-01-31 21:37:58.000000000 +0100 @@ -3,8 +3,8 @@ ##### common functionality ##### -%_python_sysconfig_path() %(%1 -c "import sysconfig as s; print(s.get_paths().get('%2'))") -%_python_sysconfig_var() %(%1 -c "import sysconfig as s; print(s.get_config_var('%2'))") +%_python_sysconfig_path() %([ -x %1 ] && %1 -c "import sysconfig as s; print(s.get_paths().get('%2'))" || echo "!!_%1_not_installed_!!") +%_python_sysconfig_var() %([ -x %1 ] && %1 -c "import sysconfig as s; print(s.get_config_var('%2'))" || echo "!!_%1_not_installed_!!") %_rec_macro_helper %{lua: rpm.define("_rec_macro_helper %{nil}") @@ -143,16 +143,21 @@ ##### PEP-518 macros ##### %pyproject_wheel(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) %{lua:\ local args = rpm.expand("%**"); \ - local intro = "%{python_expand $python -mpip wheel --no-deps %{?py_setup_args:--build-option %{py_setup_args}}"; \ - intro = intro .. " --disable-pip-version-check --use-pep517 --no-build-isolation --progress-bar off --verbose . "; \ - print(rpm.expand(intro .. args .. "}")) \ + local pyexpandstart = "%{python_expand "; \ + 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); mv -n $fn ${fn%%%%-*-*.whl}-none-any.whl"; \ + local pyexpandend = "}"; \ + print(rpm.expand(pyexpandstart .. buildwheel .. args .. "; " .. renamewheel .. pyexpandend)) \ } # No such option: --strip-file-prefix %%{buildroot} %pyproject_install(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) %{lua:\ local args = rpm.expand("%**"); \ local broot = rpm.expand("--root %buildroot"); \ - local intro = "%{python_expand $python -mpip install " .. broot .. " --disable-pip-version-check --no-compile --no-deps --progress-bar off *.whl "; \ + local intro = "%{python_expand $python -mpip install " .. broot .. " --disable-pip-version-check --no-compile --no-deps --progress-bar off build/*.whl"; \ print(rpm.expand(intro .. args .. "}")) \ print(rpm.expand("%python_compileall")) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210112.86f4d9d/macros-default-pythons new/python-rpm-macros-20210131.ec7577b/macros-default-pythons --- old/python-rpm-macros-20210112.86f4d9d/macros-default-pythons 2021-01-12 08:17:34.000000000 +0100 +++ new/python-rpm-macros-20210131.ec7577b/macros-default-pythons 2021-01-31 21:37:58.000000000 +0100 @@ -1,5 +1,6 @@ # this file should be excluded for new distributions, # where %have_$flavor is determined by installed python packages +# (see python-rpm-macros.spec) %have_python2 1 %have_python3 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210112.86f4d9d/macros.in new/python-rpm-macros-20210131.ec7577b/macros.in --- old/python-rpm-macros-20210112.86f4d9d/macros.in 2021-01-12 08:17:34.000000000 +0100 +++ new/python-rpm-macros-20210131.ec7577b/macros.in 2021-01-31 21:37:58.000000000 +0100 @@ -10,13 +10,14 @@ %endif %_python_use_flavor() \ -python_flavor=`[ -f _current_flavor ] && cat _current_flavor || true` \ -if [ -z "$python_flavor" ]; then python_flavor="tmp"; fi \ -if [ "$python_flavor" != "%1" ]; then \ - if [ -d build ]; then mv build _build.$python_flavor; fi \ +last_flavor=`[ -f _current_flavor ] && cat _current_flavor || true` \ +if [ -z "$last_flavor" ]; then last_flavor="tmp"; fi \ +if [ "$last_flavor" != "%1" ]; then \ + if [ -d build ]; then mv build _build.$last_flavor; fi \ if [ -d _build.%1 ]; then mv _build.%1 build; fi \ fi \ echo %1 > _current_flavor \ +python_flavor=%1 \ %{nil} %_python_stash_flavor() \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210112.86f4d9d/macros.lua new/python-rpm-macros-20210131.ec7577b/macros.lua --- old/python-rpm-macros-20210112.86f4d9d/macros.lua 2021-01-12 08:17:34.000000000 +0100 +++ new/python-rpm-macros-20210131.ec7577b/macros.lua 2021-01-31 21:37:58.000000000 +0100 @@ -52,25 +52,8 @@ flavor = spec_name_prefix end - subpackage_only = rpm.expand("0%{?python_subpackage_only}") ~= "0" - if subpackage_only then - is_called_python = false - modname = "" - end - -- find the spec file specpath = rpm.expand("%_specfile") - - -- search possible locations - shouldn't be necessary anymore --- local locations = { rpm.expand("%_sourcedir"), rpm.expand("%_specdir"), posix.getcwd(), posix.getcwd() .. "/" .. name } --- for _,loc in ipairs(locations) do --- local filename = loc .. "/" .. name .. ".spec" --- if posix.stat(filename, "mode") ~= nil then --- io.stderr:write("could not find spec as " .. filename .. "\n") --- specpath = filename --- break --- end --- end end function python_subpackages() @@ -80,6 +63,12 @@ local current_flavor = flavor local original_flavor = rpm.expand("%python_flavor") + subpackage_only = rpm.expand("%{python_subpackage_only}") == "1" + if subpackage_only then + is_called_python = false + modname = "" + end + -- line processing functions local function print_altered(line) -- set %name macro to proper flavor-name @@ -517,15 +506,23 @@ end end -function python_module() +-- called by %python_module, see buildset.in +function python_module_lua() rpm.expand("%_python_macro_init") local params = rpm.expand("%**") - for _, python in ipairs(pythons) do - if python == "python2" then - print(rpm.expand("%python2_prefix") .. "-" .. params) - else - print(python .. "-" .. params) + -- The Provides: tag does not support boolean dependencies, so only add parens if needed + local lpar = "" + local rpar = "" + local OPERATORS = lookup_table { 'and', 'or', 'if', 'with', 'without', 'unless'} + for p in string.gmatch(params, "%S+") do + if OPERATORS[p] then + lpar = "(" + rpar = ")" + break end - print(" ") + end + for _, python in ipairs(pythons) do + local python_prefix = rpm.expand("%" .. python .. "_prefix") + print(lpar .. python_prefix .. "-" .. string.gsub(params, "%%python", python_prefix) .. rpar .. " ") end end