#13 EPEL 8: backport %python and %pycached
Merged 3 months ago by churchyard. Opened 7 months ago by churchyard.
rpms/ churchyard/epel-rpm-macros epel8-pymacros  into  epel8

file modified
+5 -1

@@ -1,6 +1,6 @@ 

  Name:           epel-rpm-macros

  Version:        8

- Release:        9

+ Release:        10

  Summary:        Extra Packages for Enterprise Linux RPM macros

  

  Group:          System Environment/Base

@@ -58,6 +58,10 @@ 

  

  

  %changelog

+ * Tue Apr 14 2020 Miro Hrončok <mhroncok@redhat.com> - 8-10

+ - Define %%python, but make it work only if %%__python is redefined

+ - Add the %%pycached macro

+ 

  * Fri Apr 03 2020 Troy Dawson <tdawson@redhat.com> - 8-9

  - Add %qt5_qtwebengine_arches to macros

  

file modified
+25

@@ -20,6 +20,31 @@ 

  %python2 %__python2

  %python3 %__python3

  

+ # Users can use %%python only if they redefined %%__python (e.g. to %%__python3)

+ %python() %{lua:\

+     __python = rpm.expand("%__python")\

+     if __python == "/usr/bin/python" then\

+         rpm.expand("%{error:Cannot use %%python if %%__python wasn't redefined to something other than /usr/bin/python.}")\

+     else\

+         print(__python)\

+     end\

+ }

+ 

+ # This only supports Python 3.5+ and will never work with Python 2.

+ # Hence, it has no Python version in the name.

+ %pycached() %{lua:

+   path = rpm.expand("%{?1}")

+   if (string.sub(path, "-3") ~= ".py") then

+     rpm.expand("%{error:%%pycached can only be used with paths explicitly ending with .py}")

+   else

+     print(path)

+     pyminor = path:match("/python3.(%d+)/") or "*"

+     dirname = path:match("(.*/)")

+     modulename = path:match(".*/([^/]+).py")

+     print("\\n" .. dirname .. "__pycache__/" .. modulename .. ".cpython-3" .. pyminor .. "{,.opt-?}.pyc")

+   end

+ }

+ 

  # gpgverify verifies signed sources. There is documentation in the script.

  %gpgverify %{_rpmconfigdir}/gpgverify

  

Whoever merges this, please backport properly to playground, I still haven't grasped this thing.

The code looks reasonable.
However, ideally this should be reviewed by an experienced EPEL packager who has an idea of what could go wrong. I'm definitely not familiar enough with EPEL, and don't particularly want to become familiar enough.

So, maintainers of this mighty package. Are you interested in this?

Of course, but can you please rebase?

That why I am asking. If there is interest, I will rebase :)

rebased onto db76dd3

3 months ago

I have reviewed this. It looks good to me.
+1

Pull-Request has been merged by churchyard

3 months ago