Skip to content

Commit c70dcc7

Browse files
committed
Make the debug command safe for use in a zipapp
1 parent f66b3e8 commit c70dcc7

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/pip/_internal/commands/debug.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import importlib.resources
12
import locale
23
import logging
34
import os
@@ -10,7 +11,6 @@
1011
from pip._vendor.certifi import where
1112
from pip._vendor.packaging.version import parse as parse_version
1213

13-
from pip import __file__ as pip_location
1414
from pip._internal.cli import cmdoptions
1515
from pip._internal.cli.base_command import Command
1616
from pip._internal.cli.cmdoptions import make_target_python
@@ -35,11 +35,7 @@ def show_sys_implementation() -> None:
3535

3636

3737
def create_vendor_txt_map() -> Dict[str, str]:
38-
vendor_txt_path = os.path.join(
39-
os.path.dirname(pip_location), "_vendor", "vendor.txt"
40-
)
41-
42-
with open(vendor_txt_path) as f:
38+
with importlib.resources.open_text("pip._vendor", "vendor.txt") as f:
4339
# Purge non version specifying lines.
4440
# Also, remove any space prefix or suffixes (including comments).
4541
lines = [

0 commit comments

Comments
 (0)