Subject: Re: bug#52269: [core-updates-frozen] sitecustomize.py does not honor .pth files

From: Lars-Dominik Braun <[email-masked]>
Date: Thu, 16 Dec 2021 10:48:55 +0100

Hi Maxim,

> You can test it by placing the new sitecustomize.py file in the current
> directory, and then:
that works, thanks!

> I agree that after it's un-bundled it shouldn't be necessary anymore, but
> let's keep this change for core-updates along work on the 517
> python-build-system (I'll try having a look to it after the next release
> it out -- ping me otherwise).
Sure.

> +    # Move the entries that were appended to sys.path in front of
> +    # Python's own site-packages directory.  This enables Guix
> +    # packages to override Python's bundled packages, such as 'pip'.
> +    python_site_index = sys.path.index(python_site)
> +    new_site_start_index = sys.path.index(matching_sites[0])
One more nitpick: list.index() will raise a ValueError if the requested
value does not exist. I believe setting GUIX_PYTHONPATH=/nonexistent
will trigger this.

Cheers,
Lars