Mailinglist Archive: opensuse-packaging (116 mails)

< Previous Next >
Re: [opensuse-packaging] Proper way to set shebangs in singlespecs
  • From: "Luciano Santos" <luc14n0@xxxxxxxxxxxxx>
  • Date: Fri, 29 Dec 2017 02:57:15 +0100
  • Message-id: <trinity-19165cd4-4d0c-462b-8338-8c549e7cd846-1514512635023@3c-app-mailcom-lxa15>
Sent: Thursday, December 28, 2017 at 2:28 PM
From: "jan matejek" <jmatejek@xxxxxxx

there's a full list on the github page, which is linked from the wiki:
i'll make the link more prominent as soon as the wiki unlocks

Holy shell! I missed that one. I did some fragmented readings and on the last
one GitHub's reference went totally unnoticed. But the python-rpm-macros surely
gave me some insights. I will add in my to-do's list helping to improve the
python singlespec when I feel comfortable enough to.

If someone is interested, I solved my 'theoretical' problem of giving the right
python version in the after-shebang header with the following measures:

* First of all I installed manually the scripts which I wanted to edit
the python binary path;
* Then, under %install section I used `find` to look for the *.py scripts
which would be edited by `sed`;
* And, finally, under %files section I used %ifpythonX to package the

In my case the overall additions looked like this:

%python_expand mkdir -p %{buildroot}%{_docdir}/$python-gobject
%python_expand cp -R examples/* %{buildroot}%{_docdir}/$python-gobject
%python_expand find %{buildroot}%{_docdir}/$python-gobject -type f -exec\
sed -i 's|%{_bindir}/env python|%{_bindir}/$python|' {} ";"


Sounds like a lot of trouble only to give the path to the right python binary,
but it worked, again, for my 'theoretical' problem as those scripts were only
examples. And, of course, there is at least another alternative that was pointed
to me which relies on using `sed 's|#!/usr/bin/env python|#!/usr/bin/python|'`
and letting the user choose whichever python he wants to with

My solution maybe can be polished a bit, I don't know. But it can be useful in
some specific cases I believe. Any further insights on this matter is welcomed!

Wishing the best for everyone in this ending year,
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-packaging+owner@xxxxxxxxxxxx

< Previous Next >