I like to use bconds, i.e. "%if %{with python2}". They're easy to override for local builds, allowing easy experimentation with, for example, dropping Python 2. I'd be happy if our official recommendation used bconds. If we want people to copy-paste something, let's make it good.

Also, "with_python2" is the current de-facto best practice. It's a good, descriptive name, and people are used to it. The "%if 0%{?py3_may}" is not as descriptive. If that is used throughout the specfile, people will need to know/read the docs – or just consider it magic.

So, I'd prefer adding macros that set "with_python2" bconds, and using that throughout the specfile.

For a more concrete idea, would something like this work? Naming to be bikeshedded of course.

# Build for python2 if it MUST be done
%py2_bcond_if required
# Build for python3 if it MAY be done
%py3_bcond_if available




%if %{with python2}
%if %{with python3}

(And some kind of %py_build_all and %py_install_all as the next baby step? Or am I reinventing a wheel with that line of thought?)

Also, I'd like to do some wordsmithing on the proposal when the technicalities are sorted out, so the following is obvious to people who just skim it: - This new complexity is *only* meant for packagers who share specs across distros; others can stop reading now.
- FYI, we would love it if you dropped your py2 subpackage from Fedora.

On 03/02/18 10:36, Miro Hrončok wrote:
Hello Pythonistas,

I've prepared a draft for Python packaging that introduces some new macros that should ease packaging for Fedoras, EPELs and even potential new RHELs, when it comes to python stacks.

I don't do much ifs in specfiles and prefer to leverage git branches for this, so I don't know what bothers you most. The proposal with example spec file is at:


All you have to do to test it, is add the following block to your spec (that won't be needed once this is actually implemented):

     %if 0%{?fedora}
     %global py3_must 1
     %global py3_may 1
     %global py2_may 1

     %if 0%{?rhel} &&  0%{?rhel} <= 7
     %global py3_may 1
     %global py2_may 1

     %if 0%{?rhel} > 7
     ... (use your best judgment here)

Could you please provide feedback? Ask questions?

There is a note at the bottom of the draft about how you could possibly start dropping Python 2 subpackages from Fedora.

python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org

Reply via email to