public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] 'Converted' Python script suffixes vs EPYTHON
@ 2012-10-05 20:05 Michał Górny
  2012-10-06  3:26 ` Ben de Groot
  0 siblings, 1 reply; 3+ messages in thread
From: Michał Górny @ 2012-10-05 20:05 UTC (permalink / raw
  To: gentoo-python; +Cc: python

[-- Attachment #1: Type: text/plain, Size: 2135 bytes --]

Hello,

As you may know, distutils-r1 (much like python.eclass & p-d-ng)
holds separate ('converted') copies of Python scripts for each
implementation. And much like python.eclass, it will use a wrapper
program to choose the 'default' script version respecting
eselect-python.

So, if dev-python/foo installs /usr/bin/foo, the following will be
installed:

- /usr/bin/foo-pypy1_8
- /usr/bin/foo-python2_6
- /usr/bin/foo-python2_7
- /usr/bin/foo-jython2_5
               ^^^^^^^^^
- /usr/bin/foo -> py-exec

I have allowed myself to highlight the implementation suffixes in
scripts. These are suffixes used by p-d-ng, and they are the same as
implementation names used in PYTHON_TARGETS.

python.eclass used instead:
- /usr/bin/foo-2.7-pypy-1.8 (yes, seriously)
- /usr/bin/foo-2.6
- /usr/bin/foo-2.7
- /usr/bin/foo-2.5-jython

which are completely custom. Now, Gentoo's EPYTHON variable instead
contains Python executable names which are (for those suffixes):
- pypy-c1.8
- python2.6
- python2.7
- jython2.5

Now, I'm wondering what to do in order for the wrapper (py-exec)
to be optimal and compliant with Gentoo's EPYTHON (and thus
eselect-python).


1/ Use current python-distutils-ng names.

Adv:
- same values as in PYTHON_TARGETS,
- converting the ~25 ebuilds wouldn't change names.
Disadv:
- starting every python app through 'foo' would require converting
  the EPYTHON value to PYTHON_TARGETS,
- python wrapper would have to have conversion tables hardcoded (and I
  really dislike doing this).


2/ Change suffixes to match $EPYTHON.

Adv:
- makes the wrapper really simple,
- more 'compliance' with python.eclass.
Disadv:
- the EPYTHON name for pypy is 'pypy-c', so it'd be 'foo-pypy-c1.8'.


Any other ideas? Thoughts?

You can take a look at current wrapper code (it's called
python-wrapper-r1, I will rename it later)[1] but note that's
a partial solution and the actual one will be either more complex
(if 1/) or simpler (if 2/).

[1]:https://bitbucket.org/mgorny/python-wrapper-r1/src/master/src/python-wrapper.c

-- 
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] 'Converted' Python script suffixes vs EPYTHON
  2012-10-05 20:05 [gentoo-python] 'Converted' Python script suffixes vs EPYTHON Michał Górny
@ 2012-10-06  3:26 ` Ben de Groot
  2012-10-06  8:13   ` Michał Górny
  0 siblings, 1 reply; 3+ messages in thread
From: Ben de Groot @ 2012-10-06  3:26 UTC (permalink / raw
  To: gentoo-python; +Cc: Gentoo Python Project

On 6 October 2012 04:05, Michał Górny <mgorny@gentoo.org> wrote:
> Hello,
>
> As you may know, distutils-r1 (much like python.eclass & p-d-ng)
> holds separate ('converted') copies of Python scripts for each
> implementation. And much like python.eclass, it will use a wrapper
> program to choose the 'default' script version respecting
> eselect-python.
>
> So, if dev-python/foo installs /usr/bin/foo, the following will be
> installed:
>
> - /usr/bin/foo-pypy1_8
> - /usr/bin/foo-python2_6
> - /usr/bin/foo-python2_7
> - /usr/bin/foo-jython2_5
>                ^^^^^^^^^
> - /usr/bin/foo -> py-exec
>
> I have allowed myself to highlight the implementation suffixes in
> scripts. These are suffixes used by p-d-ng, and they are the same as
> implementation names used in PYTHON_TARGETS.
>
> python.eclass used instead:
> - /usr/bin/foo-2.7-pypy-1.8 (yes, seriously)
> - /usr/bin/foo-2.6
> - /usr/bin/foo-2.7
> - /usr/bin/foo-2.5-jython
>
> which are completely custom. Now, Gentoo's EPYTHON variable instead
> contains Python executable names which are (for those suffixes):
> - pypy-c1.8
> - python2.6
> - python2.7
> - jython2.5
>
> Now, I'm wondering what to do in order for the wrapper (py-exec)
> to be optimal and compliant with Gentoo's EPYTHON (and thus
> eselect-python).
>
>
> 1/ Use current python-distutils-ng names.
>
> Adv:
> - same values as in PYTHON_TARGETS,
> - converting the ~25 ebuilds wouldn't change names.
> Disadv:
> - starting every python app through 'foo' would require converting
>   the EPYTHON value to PYTHON_TARGETS,
> - python wrapper would have to have conversion tables hardcoded (and I
>   really dislike doing this).
>
>
> 2/ Change suffixes to match $EPYTHON.
>
> Adv:
> - makes the wrapper really simple,
> - more 'compliance' with python.eclass.
> Disadv:
> - the EPYTHON name for pypy is 'pypy-c', so it'd be 'foo-pypy-c1.8'.
>
>
> Any other ideas? Thoughts?
>
> You can take a look at current wrapper code (it's called
> python-wrapper-r1, I will rename it later)[1] but note that's
> a partial solution and the actual one will be either more complex
> (if 1/) or simpler (if 2/).
>
> [1]:https://bitbucket.org/mgorny/python-wrapper-r1/src/master/src/python-wrapper.c
>
> --
> Best regards,
> Michał Górny

I vote for simple = 2.

-- 
Cheers,

Ben | yngwin
Gentoo developer
Gentoo Qt project lead, Gentoo Wiki admin


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-python] 'Converted' Python script suffixes vs EPYTHON
  2012-10-06  3:26 ` Ben de Groot
@ 2012-10-06  8:13   ` Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2012-10-06  8:13 UTC (permalink / raw
  To: Ben de Groot; +Cc: gentoo-python, Gentoo Python Project

[-- Attachment #1: Type: text/plain, Size: 3019 bytes --]

On Sat, 6 Oct 2012 11:26:35 +0800
Ben de Groot <yngwin@gentoo.org> wrote:

> On 6 October 2012 04:05, Michał Górny <mgorny@gentoo.org> wrote:
> > Hello,
> >
> > As you may know, distutils-r1 (much like python.eclass & p-d-ng)
> > holds separate ('converted') copies of Python scripts for each
> > implementation. And much like python.eclass, it will use a wrapper
> > program to choose the 'default' script version respecting
> > eselect-python.
> >
> > So, if dev-python/foo installs /usr/bin/foo, the following will be
> > installed:
> >
> > - /usr/bin/foo-pypy1_8
> > - /usr/bin/foo-python2_6
> > - /usr/bin/foo-python2_7
> > - /usr/bin/foo-jython2_5
> >                ^^^^^^^^^
> > - /usr/bin/foo -> py-exec
> >
> > I have allowed myself to highlight the implementation suffixes in
> > scripts. These are suffixes used by p-d-ng, and they are the same as
> > implementation names used in PYTHON_TARGETS.
> >
> > python.eclass used instead:
> > - /usr/bin/foo-2.7-pypy-1.8 (yes, seriously)
> > - /usr/bin/foo-2.6
> > - /usr/bin/foo-2.7
> > - /usr/bin/foo-2.5-jython
> >
> > which are completely custom. Now, Gentoo's EPYTHON variable instead
> > contains Python executable names which are (for those suffixes):
> > - pypy-c1.8
> > - python2.6
> > - python2.7
> > - jython2.5
> >
> > Now, I'm wondering what to do in order for the wrapper (py-exec)
> > to be optimal and compliant with Gentoo's EPYTHON (and thus
> > eselect-python).
> >
> >
> > 1/ Use current python-distutils-ng names.
> >
> > Adv:
> > - same values as in PYTHON_TARGETS,
> > - converting the ~25 ebuilds wouldn't change names.
> > Disadv:
> > - starting every python app through 'foo' would require converting
> >   the EPYTHON value to PYTHON_TARGETS,
> > - python wrapper would have to have conversion tables hardcoded (and I
> >   really dislike doing this).
> >
> >
> > 2/ Change suffixes to match $EPYTHON.
> >
> > Adv:
> > - makes the wrapper really simple,
> > - more 'compliance' with python.eclass.
> > Disadv:
> > - the EPYTHON name for pypy is 'pypy-c', so it'd be 'foo-pypy-c1.8'.
> >
> >
> > Any other ideas? Thoughts?
> >
> > You can take a look at current wrapper code (it's called
> > python-wrapper-r1, I will rename it later)[1] but note that's
> > a partial solution and the actual one will be either more complex
> > (if 1/) or simpler (if 2/).
> >
> > [1]:https://bitbucket.org/mgorny/python-wrapper-r1/src/master/src/python-wrapper.c
> >
> > --
> > Best regards,
> > Michał Górny
> 
> I vote for simple = 2.

https://bitbucket.org/mgorny/gx86-working-tree/src/python-r1-w-epython-suffixes
http://git.overlays.gentoo.org/gitweb/?p=dev/mgorny.git;a=shortlog;h=refs/heads/python-r1-migration
https://bitbucket.org/mgorny/python-exec/src/epython-suffixes

On these branches, 2/ is implemented. Well, you probably gotta stack it
all together by hand right now but it should be enough to review it :P.

-- 
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

end of thread, other threads:[~2012-10-06  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-05 20:05 [gentoo-python] 'Converted' Python script suffixes vs EPYTHON Michał Górny
2012-10-06  3:26 ` Ben de Groot
2012-10-06  8:13   ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox