10000 Set dist_name to UNKNOWN when empty outside venv · pypa/pip@e7b1722 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7b1722

Browse files
committed
Set dist_name to UNKNOWN when empty outside venv
For compatibility with distutils. This is only done when pip is not inside a virtual environment due to a quirk in pip's previous implementation to the header path.
1 parent 75ba96c commit e7b1722

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

news/9838.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix compatibility between distutils and sysconfig when the project name is unknown outside of a virtual environment.

src/pip/_internal/locations/_sysconfig.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,16 @@ def get_scheme(
128128
paths = sysconfig.get_paths(scheme=scheme_name, vars=variables)
129129

130130
# Pip historically uses a special header path in virtual environments.
131+
# Logic here is very arbitrary, we're doing it for compatibility, don't ask.
131132
if running_under_virtualenv():
132133
if user:
133134
base = variables.get("userbase", sys.prefix)
134135
else:
135136
base = variables.get("base", sys.prefix)
136137
python_xy = f"python{get_major_minor_version()}"
137138
paths["include"] = os.path.join(base, "include", "site", python_xy)
139+
elif not dist_name:
140+
dist_name = "UNKNOWN"
138141

139142
scheme = Scheme(
140143
platlib=paths["platlib"],

0 commit comments

Comments
 (0)
0