sysconfig.get_path('platstdlib') return paths in virtual environments (or otherwise weird)
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 36k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza en Lib/sysconfig.py, alrededor de la línea 30, y reproduce los resultados indicados de sysconfig.get_path('stdlib') y get_path('platstdlib') en un entorno virtual, en la imagen de Docker Python 3.11.1 y en Fedora Linux. Se considera terminado cuando la ruta de la biblioteca estándar específica de la plataforma es coherente con la distinción documentada en estos entornos y se ha añadido cobertura de regresión donde la suite de pruebas existente gestiona las rutas de sysconfig.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- tooling
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100