File revert-pyproject-macro.patch of Package saltbundlepy-rpm-macros

--- a/flavor.in
+++ b/flavor.in
@@ -41,49 +41,6 @@
 %__#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 \
-%#FLAVOR#_compile \
-%#FLAVOR#_fix_shebang
-
 %#FLAVOR#_compile \
 for d in %{buildroot}%{#FLAVOR#_sitelib} %{buildroot}%{#FLAVOR#_sitearch}; do \
   if [ -d $d ]; then \
--- a/macros/010-common-defs
+++ b/macros/010-common-defs
@@ -170,6 +170,35 @@
     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 .. " --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")) \
+}
+
 ##### Find language files #####
 
 %python_find_lang() \
--- a/macros.lua
+++ b/macros.lua
@@ -446,20 +446,6 @@
     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_compileall()
     rpm.expand("%_python_macro_init")
     for _, python in ipairs(pythons) do
openSUSE Build Service is sponsored by