Skip to content

Disable vendored appdirs loading C library #4992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/pip/_vendor/appdirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,18 +557,14 @@ def _get_win_folder_with_jna(csidl_name):

if system == "win32":
try:
import win32com.shell
_get_win_folder = _get_win_folder_with_pywin32
from ctypes import windll
_get_win_folder = _get_win_folder_with_ctypes
except ImportError:
try:
from ctypes import windll
_get_win_folder = _get_win_folder_with_ctypes
import com.sun.jna
_get_win_folder = _get_win_folder_with_jna
except ImportError:
try:
import com.sun.jna
_get_win_folder = _get_win_folder_with_jna
except ImportError:
_get_win_folder = _get_win_folder_from_registry
_get_win_folder = _get_win_folder_from_registry


#---- self test code
Expand Down
1 change: 0 additions & 1 deletion src/pip/_vendor/appdirs.pyi

This file was deleted.

6 changes: 4 additions & 2 deletions tasks/vendoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ def update_stubs(ctx):

print("[vendoring.update_stubs] Add mypy stubs")

# Some projects need stubs other than a simple <name>.pyi
extra_stubs_needed = {
"six": ["six.__init__", "six.moves"]
# Some projects need stubs other than a simple <name>.pyi
"six": ["six.__init__", "six.moves"],
# Some projects should not have stubs coz they're single file modules
"appdirs": [],
}

for lib in vendored_libs:
Expand Down
28 changes: 28 additions & 0 deletions tasks/vendoring/patches/appdirs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/src/pip/_vendor/appdirs.py b/src/pip/_vendor/appdirs.py
index ae67001a..2bd39110 100644
--- a/src/pip/_vendor/appdirs.py
+++ b/src/pip/_vendor/appdirs.py
@@ -557,18 +557,14 @@ def _get_win_folder_with_jna(csidl_name):

if system == "win32":
try:
- import win32com.shell
- _get_win_folder = _get_win_folder_with_pywin32
+ from ctypes import windll
+ _get_win_folder = _get_win_folder_with_ctypes
except ImportError:
try:
- from ctypes import windll
- _get_win_folder = _get_win_folder_with_ctypes
+ import com.sun.jna
+ _get_win_folder = _get_win_folder_with_jna
except ImportError:
- try:
- import com.sun.jna
- _get_win_folder = _get_win_folder_with_jna
- except ImportError:
- _get_win_folder = _get_win_folder_from_registry
+ _get_win_folder = _get_win_folder_from_registry


#---- self test code