[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#52269: [PATCH core-updates-frozen] sitecustomize does not honor .pth
From: |
Maxim Cournoyer |
Subject: |
bug#52269: [PATCH core-updates-frozen] sitecustomize does not honor .pth files |
Date: |
Sat, 04 Dec 2021 00:36:23 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
tags 52269 patch
thanks
Hi!
The following patch fixes it. I used site.addsitedir but ensured the
correct ordering of sys.path (we need to make the Guix-installed
packages appear before Python's own site-packages directory otherwise we
wouldn't be able to override its bundled packages such as 'pip').
Here's how I tested:
Copy the sitecustomize.py file to the current directory, then:
--8<---------------cut here---------------start------------->8---
$ pip --version
pip 21.1.3 from $HOME/.guix-profile/lib/python3.9/site-packages/pip (python 3.9)
$ guix show python-pip | recsel -p version
version: 20.2.4
--8<---------------cut here---------------end--------------->8---
Ensure installed pip still overrides Python's own. PYTHONPATH=. forces
the sitecustomize.py file in the CWD to take precedence over the one
currently installed along Python.
--8<---------------cut here---------------start------------->8---
$ guix shell --pure python python-pip python-pdbpp
[env]$ PYTHONPATH=. python3 -c 'import pip; print(pip.__version__)'
20.2.4
--8<---------------cut here---------------end--------------->8---
Next I created a dummy script to trigger run pdb:
#file: test.py
print('hello')
import pdb; pdb.set_trace()
--8<---------------cut here---------------start------------->8---
$ guix shell --pure python python-pip python-pdbpp
[env]$ python3 test.py
hello
> /tmp/toto/test.py(7)<module>()
-> exit(1)
(Pdb)
--8<---------------cut here---------------end--------------->8---
This is the current bug; this is the regular Pdb, not Pdbpp. Let's
force our revised sitecustomize.py file:
--8<---------------cut here---------------start------------->8---
$ PYTHONPATH=. python3 test.py
hello
[0] > /tmp/toto/test.py(7)<module>()
-> exit(1)
(Pdb++)
--8<---------------cut here---------------end--------------->8---
Better!
0001-sitecustomize.py-Honor-.pth-files.patch
Description: Text Data