pypa / virtualenv

Virtual Python Environment builder
https://virtualenv.pypa.io
MIT License
4.8k stars 1.03k forks source link

Values in `pyvenv.cfg` do not reflect the real paths on case insensitive file systems #2684

Closed ofek closed 7 months ago

ofek commented 7 months ago

I noticed this because within a virtual environment the paths that sysconfig returns are in all caps for some reason:

Screenshot 2024-01-21 220244

home = C:\USERS\OFEK\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON311
implementation = CPython
version_info = 3.11.1.final.0
virtualenv = 20.25.0
include-system-site-packages = false
base-prefix = C:\USERS\OFEK\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON311
base-exec-prefix = C:\USERS\OFEK\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON311
base-executable = C:\USERS\OFEK\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON311\PYTHON.EXE

This might not seem like a big deal but users see these paths in debug output when building packages if the build uses virtual environments.

ofek commented 7 months ago

Saving the resolved paths like this issue wants would also fix this because os.path.realpath returns the path as saved on disk.

gaborbernat commented 7 months ago

PR welcome to address this is welcome 👍

ofek commented 7 months ago

Can you please point to the general area of the code base that I should look at?

gaborbernat commented 7 months ago

Either https://github.com/pypa/virtualenv/tree/main/src/virtualenv/create/via_global_ref/builtin or https://github.com/pypa/virtualenv/blob/main/src/virtualenv/discovery/py_info.py#L35

ofek commented 7 months ago

I don't know why but upgrading from 3.11.1 to 3.11.7 fixed the issue.