sysconfig.get_path('platstdlib') return paths in virtual environments (or otherwise weird)
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 36k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug report
The sysconfig.get_path function is supposed to return he following for its first argument:
stdlib: directory containing the standard Python library files that are not platform-specific.platstdlib: directory containing the standard Python library files that are platform-specific.
E.g. in the python:3.11.1 Docker container:
>>> import sysconfig
>>> sysconfig.get_path('stdlib')
'/usr/local/lib/python3.11'
>>> sysconfig.get_path('platstdlib')
'/usr/local/lib/python3.11'
Or on a Python build configured with lib64 platlibdir (e.g. on Fedora Linux with $RPM_BUILD_ROOT environment variable set):
>>> import sysconfig
>>> sysconfig.get_path('stdlib')
'/usr/lib64/python3.11'
>>> sysconfig.get_path('platstdlib')
'/usr/lib64/python3.11'
Yet in virtual environments, the platstdlib directory returns a directory from within the virtual environment. E.g. in the python:3.11.1 Docker container:
>>> import sysconfig
>>> sysconfig.get_path('stdlib')
'/usr/local/lib/python3.11'
>>> sysconfig.get_path('platstdlib')
'.../myvenv/lib/python3.11'
Or on Fedora Linux:
>>> import sysconfig
>>> sysconfig.get_path('stdlib')
'/usr/lib64/python3.11'
>>> sysconfig.get_path('platstdlib')
'.../myvenv/lib64/python3.11'
This even confuses the default values on Fedora Linux (without $RPM_BUILD_ROOT environment variable set):
>>> import sysconfig
>>> sysconfig.get_path('stdlib')
'/usr/lib64/python3.11'
>>> sysconfig.get_path('platstdlib')
'/usr/local/lib64/python3.11'
I believe that here:
https://github.com/python/cpython/blob/62251c3da06eb4662502295697f39730565b1717/Lib/sysconfig.py#L30
The {platbase} variable should be replaced with {insatlled_base} or even (currently AFAIK nonexistent) {insatlled_platbase}.
Your environment
- CPython versions tested on: 3.11.1
- Operating system and architecture: Fedora Linux 37 x86_64, python:3.11.1 Docker container.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in Lib/sysconfig.py intorno alla riga 30 e riproduci i risultati segnalati di sysconfig.get_path('stdlib') e get_path('platstdlib') in un ambiente virtuale, nell'immagine Docker Python 3.11.1 e su Fedora Linux. Il lavoro è completato quando il percorso della libreria standard specifico della piattaforma è coerente con la distinzione documentata in questi ambienti e viene aggiunta una copertura di regressione nel punto in cui la suite di test esistente gestisce i percorsi sysconfig.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100