unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Konrad Hinsen <konrad.hinsen@fastmail.net>
To: "Ludovic Courtès" <ludo@gnu.org>, Rutherther <rutherther@protonmail.com>
Cc: 73304@debbugs.gnu.org, Josselin Poiret <dev@jpoiret.xyz>,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#73304: Python in relocatable guix pack leads to wrong sys.path
Date: Wed, 02 Oct 2024 08:20:51 +0200	[thread overview]
Message-ID: <m15xqbqb3w.fsf@fastmail.net> (raw)
In-Reply-To: <87zfno3l4i.fsf@gnu.org>

Ludovic Courtès <ludo@gnu.org> writes:

> Rutherther <rutherther@protonmail.com> skribis:
>
>> When I add both python and a python package (seems like any) to a
>> relocatable guix pack, the resulting python in the merged profile seems
>> to be broken. Specifically its `sys.path` contains missing paths.

> Commit d5e0180805f52ef38a03ff9d6c11dd6174e3526b fixed a similar issue I
> think, discussed at <https://issues.guix.gnu.org/53258>.
>
> Not sure whether it’s a new problem here.  Konrad, Maxim, Josselin,
> WDYT? :-)

This problem clearly looks like it's caused by our sitecustomize.py.
One indicator is "When I add both python and a python package": if there
is no additional package, only python by itself, our sitecustomize
doesn't do anything.

However, I don't see how the recent patch (see
https://issues.guix.gnu.org/68241) could be responsible for this new
problem. It should have happened before as well.

Here is what sitecustomize.py does:

 1. Collect the "site-packages" subdirectories of everything on
    $GUIX_PYTHONPATH.
 2. Normalize them via sys.normpath()
 3. Add them to sys.path
 4. Re-arrange the elements in sys.path such that the add-on
    packages come before Python's standard library.

The recent patch fixes a bug in the last step, which wasn't executed at
all (and generated an error message). So the difference between the
current and the previous behavior is only the order of entries in
sys.path.

The current problem is that even the standard library's paths are wrong.
I suspect that this is due to sys.normpath not implementing the correct
POSIX semantics for dot-dot.

Cheers,
  Konrad.




  parent reply	other threads:[~2024-10-02  6:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-16 19:23 bug#73304: Python in relocatable guix pack leads to wrong sys.path Rutherther via Bug reports for GNU Guix
2024-09-16 19:28 ` Rutherther via Bug reports for GNU Guix
2024-09-30 21:08 ` Ludovic Courtès
2024-10-01 19:39   ` Rutherther via Bug reports for GNU Guix
2024-10-02  6:20   ` Konrad Hinsen [this message]
2024-10-02 11:59     ` Konrad Hinsen
2024-10-06  8:29       ` Konrad Hinsen
2024-10-14 11:11         ` Ludovic Courtès

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=m15xqbqb3w.fsf@fastmail.net \
    --to=konrad.hinsen@fastmail.net \
    --cc=73304@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=ludo@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    --cc=rutherther@protonmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).