![](https://seccdn.libravatar.org/avatar/f7fd25bd4afbd5b80af193b390563b6a.jpg?s=120&d=mm&r=g)
On 22.8.2016 20:21, Todd Rme wrote:
Also there is an interesting technical dilemma with this syntax: either %if_cpython2 means "if cpython2 is in the buildset", or "if the following piece of code applies to the cpython2 subpackage". These are very different in the requires/filelist context:
This was intended for the latter case. I can't think of a situation where it would be useful for one python variant to know that some other python variant is also being built. I thought the whole idea was to keep them separate.
The problem becomes apparent when you want a spec file that can build for "all available pythons". You might want to include instructions in %build that apply to python3 only, and you might want the spec file to pass even when python3 is not in the build set. Of course, we can simply say that this configuration is not supported and that the spec itself defines required python versions. That's one way to resolve this. Another is to rely on "%if %have_flavor" for the former purpose, and reserve "%if_cpython2" for the latter.
BuildRequires: %py_buildrequires
With my current approach this doesn't seem useful at all? Either you use %{python_module foo} to get module for all pythons that are in %have_flavor, or you can list the buildrequires explicitly.
Some buildrequires are only relevant, or only available, for certain python variants. So there needs to be some way to specify buildrequires on a per-variant basis. You could wrap them in an %if_foo clause, but that seems much more verbose to me.
BuildRequires are common for the whole spec file. All of them must be present. Say you have a package that needs %flavor-setuptools and %flavor-nose for all %flavors, but pypy-featuresupport for pypy only, and python3-legacy-prints for python3 only: BuildRequires: %{python_module setuptools} BuildRequires: %{python_module nose} BuildRequires: pypy-featuresupport BuildRequires: python3-legacy-prints If we want to support building for "all available pythons", then pypy and python3 requires have to be conditional, yes. But in such case, i'd prefer to use "%if %have_pypy" conditional to signal the intent.