Applications using python (and py*-gtk)

Joshua Root jmr at macports.org
Fri Apr 13 07:58:50 PDT 2012


On 2012-4-14 00:41 , Thibaut Paumard wrote:
> Hi,
> 
> I maintain 2 ports (yorick-yao and yorick-spydr) which depend on
> py26-gtk, and I have recently submitted a third similar port
> (yorick-cubeview, https://trac.macports.org/ticket/34013).
> 
> All those cases are similar: they really are Yorick applications with a
> GUI written in python, using py-gtk. All three can be launched as a
> stand-alone utility (which invokes yorick, which invokes python) or from
> the yorick prompt.
> 
> Currently, the three ports depend on py26-gtk, in the naive hope that
> "python" really is python2.6. The python interpreter is launched from
> the script's shabang line:
>    #!/usr/bin/env python
> 
> I think this is not correct and I should ensure the python that is used
> really is the one for which I make sure py-gtk gets installed.
> 
> I could do that by patching the shabang line:
>    #!/usr/bin/env python2.6

You can't count on the user's $PATH being the way you want, so this
needs to be:
#!${prefix}/bin/python2.6

You can accomplish this like so:

reinplace "s|#!/usr/bin/env python|#!${prefix}/bin/python2.6|" \
${worksrcpath}/some/file.py

> but before I do that, I would like to check whether you have better
> suggestions, and perhaps which python version is the favoured one
> nowadays (from what I see in python module ports, I'm guessing it must
> be 2.7).

Yes, python 2.7 is generally the preferred version.

- Josh


More information about the macports-dev mailing list