#27 Define %python2 and %python3
Merged 5 months ago by churchyard. Opened 6 months ago by churchyard.
rpms/ churchyard/python-rpm-macros nodunders  into  master

file modified
+6

@@ -2,9 +2,15 @@ 

  # - they can be used in Build/Requires

  # - they can be used in non-Python packages where requiring pythonX-devel would

  #   be an overkill

+ 

+ # use the underscored macros to redefine the behavior of %%python3_version etc.

  %__python2 /usr/bin/python2

  %__python3 /usr/bin/python3

  

+ # use the non-underscored macros to refer to Python in spec, etc.

+ %python2 %__python2

+ %python3 %__python3

+ 

  # For backwards compatibility only

  # See the comments in https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/22

  %__python /usr/bin/python

file modified
+4 -1

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

  Name:           python-rpm-macros

  Version:        3

- Release:        48%{?dist}

+ Release:        49%{?dist}

  Summary:        The unversioned Python RPM macros

  

  # macros: MIT, compileall2.py: PSFv2

@@ -78,6 +78,9 @@ 

  

  

  %changelog

+ * Fri Sep 27 2019 Miro Hrončok <mhroncok@redhat.com> - 3-49

+ - Define %%python2 and %%python3

+ 

  * Mon Aug 26 2019 Miro Hrončok <mhroncok@redhat.com> - 3-48

  - Drop --strip-file-prefix option from %%pyX_install_wheel macros, it is not needed

  

I haven't added a changelog entry yet, will do if we agree this is good.

cc @tibbs

I'd think you would define %pythonX in terms of %__pythonX rather than the other way around, but I guess I don't really know if it matters. i suspect @pmatilai might be able to say if RPM upstream would have a preference.

Regardless of this detail, this is certainly something we want to do.

My idea is that if we keep using %__pythonX internally, we have an easier maintenance - backporting remains easy. This also has the benefit of the following:

  • Old specs don't need to bother with %pythonX at all. Everything works for them as it used to work.
  • New specs can define %pythonX and all the macros including %__pythonX will be redefined as well.

I don't think we disageee. Certainly internal to various python macros, %__pythonX should be used. But if the%python3, should the internal %__python3 be redefined as well?

The idea is that redefining %python3 also redefines %python3_version, %python3_sitelib etc. Or is that a wrong assumption?

bumping the question. can we have this?

@pmatilai Could you please have a look?

We've talked about this at the FPC meeting.

https://meetbot.fedoraproject.org/fedora-meeting-1/2019-09-26/fpc.2019-09-26-16.00.html

We should do it the other way around and make it so that it possible to:

  • use %python3, %python3_version, %python3_sitearch... to GET information
  • redefine %__python3 to SET information

Sorry this has gone largely under my radar, possibly because of marked WIP status (which I took to mean patches will be updated before considered final and ready for review, which clearly is not what was intended here)

use %python3, %python3_version, %python3_sitearch... to GET information
redefine %__python3 to SET information

Ooh. That's nice. A clear, generic rule to the whole double-underscore macro issue.

Now that you put it into words, that's largely how rpm's own double underscore macros have always been intended to use, there's just so much historical "abuse" and inconsistent use inside and outside rpm that it's hard to see the picture from the distortions.

The WIP was used here because the discussion is still going on and the patch will change. Sorry for the confusion.

Thanks for the feedback, I'll update the PR.

rebased onto af35bb0

5 months ago

Rebased, ready for final review. I plan to backport this to all Fedoras and EPELs.

Yes, WIP can mean any number of things, and nothing wrong with the usage here. My bad for the narrow interpretation.

Pull-Request has been merged by churchyard

5 months ago