* [gentoo-python] Wrapping scripts for multiple Python implementations: executable wrapper or symlinks?
@ 2012-09-29 20:46 Michał Górny
2012-09-30 3:42 ` Mike Gilbert
0 siblings, 1 reply; 3+ messages in thread
From: Michał Górny @ 2012-09-29 20:46 UTC (permalink / raw
To: gentoo-python
[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]
Hello,
Right now we have two different ways of 'wrapping' Python scripts
'converted' for various Python implementations. One of them
is the wrapper script installed by python.eclass, the other symlinking
done by python-distutils-ng.eclass.
I would like to ask you which one do you consider better, and thus
which one should I use for python-r1/distutils-r1.
A quick summary of possibilities:
1/ executable wrapper:
A wrapper script (or executable) will be installed by a common
package in the system. The various Python scripts will be symlinked
to it, e.g.:
/usr/bin/flaggie -> python-wrapper
When run, the script will check the currently selected ABI (via
eselect-python) and run the script using it if possible. Otherwise,
it will try the best implementation available on the system
and supported by the package.
Advantages:
- respects eselect-python (when possible).
Disadvantages:
- more complex,
- slows down script startup.
2/ symlink:
When the package is installed, a symlink is created to the version
for the preferred Python implementation. If it is not supported,
the symlink points to the 'best' implementation supported.
/usr/bin/flaggie -> flaggie-python2_7
Advantages:
- simple,
- resolution handled directly.
Disadvantages:
- the preferred implementation can not be changed at runtime.
3/ partially-shebanged copy of the script:
One more copy of the script is installed, with a more general shebang
like:
#!/usr/bin/env python
or:
#!/usr/bin/env python2
Advantages:
- respects eselect-python.
Disadvantages:
- limited use (only simple version ranges),
- yet one more copy of the same script...
What do you think?
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-python] Wrapping scripts for multiple Python implementations: executable wrapper or symlinks?
2012-09-29 20:46 [gentoo-python] Wrapping scripts for multiple Python implementations: executable wrapper or symlinks? Michał Górny
@ 2012-09-30 3:42 ` Mike Gilbert
2012-09-30 5:21 ` Ben de Groot
0 siblings, 1 reply; 3+ messages in thread
From: Mike Gilbert @ 2012-09-30 3:42 UTC (permalink / raw
To: Michał Górny, gentoo-python
On Sat, Sep 29, 2012 at 4:46 PM, Michał Górny <mgorny@gentoo.org> wrote:
> Hello,
>
> Right now we have two different ways of 'wrapping' Python scripts
> 'converted' for various Python implementations. One of them
> is the wrapper script installed by python.eclass, the other symlinking
> done by python-distutils-ng.eclass.
>
> I would like to ask you which one do you consider better, and thus
> which one should I use for python-r1/distutils-r1.
>
Of the choices, the wrapper idea (option 1) would be my preference.
Functionality-wise, it is closest to what we have with the generated
wrappers.
The symlink option sucks given the way eselect python works.
Another problem with option 3 (generic shebangs) is how to decide
which version of the script should be the one installed with a generic
shebang. It is possible that a package may run 2to3 as one of the
installation steps, which would mean that you would not have a script
that would work in both python2 and python3.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-python] Wrapping scripts for multiple Python implementations: executable wrapper or symlinks?
2012-09-30 3:42 ` Mike Gilbert
@ 2012-09-30 5:21 ` Ben de Groot
0 siblings, 0 replies; 3+ messages in thread
From: Ben de Groot @ 2012-09-30 5:21 UTC (permalink / raw
To: gentoo-python
On 30 September 2012 11:42, Mike Gilbert <floppym@gentoo.org> wrote:
> On Sat, Sep 29, 2012 at 4:46 PM, Michał Górny <mgorny@gentoo.org> wrote:
>> Hello,
>>
>> Right now we have two different ways of 'wrapping' Python scripts
>> 'converted' for various Python implementations. One of them
>> is the wrapper script installed by python.eclass, the other symlinking
>> done by python-distutils-ng.eclass.
>>
>> I would like to ask you which one do you consider better, and thus
>> which one should I use for python-r1/distutils-r1.
>>
>
> Of the choices, the wrapper idea (option 1) would be my preference.
> Functionality-wise, it is closest to what we have with the generated
> wrappers.
>
I also prefer option 1.
--
Cheers,
Ben | yngwin
Gentoo developer
Gentoo Qt project lead, Gentoo Wiki admin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-30 5:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-29 20:46 [gentoo-python] Wrapping scripts for multiple Python implementations: executable wrapper or symlinks? Michał Górny
2012-09-30 3:42 ` Mike Gilbert
2012-09-30 5:21 ` Ben de Groot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox