public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-python@lists.gentoo.org
Subject: [gentoo-python] Replacing python-wrapper with python-exec
Date: Wed, 31 Oct 2012 10:17:56 +0100	[thread overview]
Message-ID: <20121031101756.21b8a92a@pomiocik.lan> (raw)

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

Hello,

Now that python-exec spawns random Python scripts happily, I think we
can consider replacing python-wrapper (the one that spawns Python
itself) with it as well. The idea is similar, and the code is much
simpler here.

However, a bit of hackery would need to be done to change python-exec's
behavior. Right now, it spawns "$0-$EPYTHON" but it will need to just
spawn "$EPYTHON" when run as 'python'. I think we can do it in one
of the following ways:


1) add an 'if' clause to the code, looking for argv[0]~=python.

Simply saying, if python-exec is run as python, just run $EPYTHON,
without prepending $0-. As simple as it can be.

Pros:

- a simple solution.

Cons:

- potentially fragile -- check relies on argv[0]; someone symlinks it
  to a different name -- boom;

- the 'if' check done for every other script where it is irrelevant.


2) add '-$EPYTHON' symlinks to the python interpreters.

So:
  /usr/bin/python-python2.7 -> python2.7
  /usr/bin/python-python2.6 -> python2.6
  /usr/bin/python-pypy-c1.9 -> pypy-c1.9

Pros:

- will work with python-exec as-is.

Cons:

- $PATH pollution.

Note: if we ever wanted to replace Python implementations with
additional wrappers (e.g. trying to fix bug #438984[1]) the 'long
names' could carry the actual Python executables. But that's probably
a bad idea anyway.

[1]:https://bugs.gentoo.org/show_bug.cgi?id=438984


3) add an '#if' clause and build the Python-relevant code conditionally.

In other words, let python-exec install both regular 'python-exec'
and the 'python' binary built from the same code with '#if' switched.

Pros:

- still simple, and clean.

Cons:

- two executables installed.


What are your thoughts?

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

             reply	other threads:[~2012-10-31  9:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31  9:17 Michał Górny [this message]
2012-10-31 17:07 ` [gentoo-python] Replacing python-wrapper with python-exec Mike Gilbert
2012-11-01 22:09   ` Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121031101756.21b8a92a@pomiocik.lan \
    --to=mgorny@gentoo.org \
    --cc=gentoo-python@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox