Mailinglist Archive: opensuse-packaging (116 mails)

< Previous Next >
[opensuse-packaging] Re: Proper way to set shebangs in singlespecs

On 22.12.2017 10:36, Sebastian wrote:
You can use %ifpython2/%ifpython3, which is true if the package is build
for python2/3.

based on a couple of recent postings, I feel like i need to shout:


correct (mostly) is:
%if 0%{?have_python2}

%ifpython2 and %ifpython3 work on:
- Requires
- %files
- %pre/%post

in other words, they determine if the text *is included in section for
python2/python3 subpackage*

the build scripts (%prep, %build, %install, %check) are COMMON to all the
subpackages. Using
%ifpython there does the wrong thing.

I have added a warning to the wiki page. I also appreciate any suggestions on
how to make this
clearer in the docs -- and how to make it fail in code, because people don't
read docs :)

The problem is that there isn't actually a macro for "true if package is built
for python2/3". This
needs to be fixed. Now you can use "%if 0%{?have_python2}". It's not exactly
the right thing but it
Since the example files go both under python2-gobject's doc folder and
python3-gobject's doc folder as well, I have being thinking using something
like this (theoretically speaking):

sed -i 'python2 shebang on you'
sed -i 'python3 shebang on you'
You can do that (using %{buildroot} for the paths).

%python_expand sed -i '$python for you'
%{buildroot}%{_datadir}/doc/packages/$python-gobject .....

< Previous Next >
Follow Ups