Skip to content

Commit 1ea3f89

Browse files
authored
Merge pull request #4992 from pradyunsg/vendor/disable-appdirs-loading-c-library
Disable vendored appdirs loading C library
2 parents beffa5d + 25afbd3 commit 1ea3f89

File tree

4 files changed

+37
-12
lines changed

4 files changed

+37
-12
lines changed

src/pip/_vendor/appdirs.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -557,18 +557,14 @@ def _get_win_folder_with_jna(csidl_name):
557557

558558
if system == "win32":
559559
try:
560-
import win32com.shell
561-
_get_win_folder = _get_win_folder_with_pywin32
560+
from ctypes import windll
561+
_get_win_folder = _get_win_folder_with_ctypes
562562
except ImportError:
563563
try:
564-
from ctypes import windll
565-
_get_win_folder = _get_win_folder_with_ctypes
564+
import com.sun.jna
565+
_get_win_folder = _get_win_folder_with_jna
566566
except ImportError:
567-
try:
568-
import com.sun.jna
569-
_get_win_folder = _get_win_folder_with_jna
570-
except ImportError:
571-
_get_win_folder = _get_win_folder_from_registry
567+
_get_win_folder = _get_win_folder_from_registry
572568

573569

574570
#---- self test code

src/pip/_vendor/appdirs.pyi

Lines changed: 0 additions & 1 deletion
This file was deleted.

tasks/vendoring/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,11 @@ def update_stubs(ctx):
144144

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

147-
# Some projects need stubs other than a simple <name>.pyi
148147
extra_stubs_needed = {
149-
"six": ["six.__init__", "six.moves"]
148+
# Some projects need stubs other than a simple <name>.pyi
149+
"six": ["six.__init__", "six.moves"],
150+
# Some projects should not have stubs coz they're single file modules
151+
"appdirs": [],
150152
}
151153

152154
for lib in vendored_libs:
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff --git a/src/pip/_vendor/appdirs.py b/src/pip/_vendor/appdirs.py
2+
index ae67001a..2bd39110 100644
3+
--- a/src/pip/_vendor/appdirs.py
4+
+++ b/src/pip/_vendor/appdirs.py
5+
@@ -557,18 +557,14 @@ def _get_win_folder_with_jna(csidl_name):
6+
7+
if system == "win32":
8+
try:
9+
- import win32com.shell
10+
- _get_win_folder = _get_win_folder_with_pywin32
11+
+ from ctypes import windll
12+
+ _get_win_folder = _get_win_folder_with_ctypes
13+
except ImportError:
14+
try:
15+
- from ctypes import windll
16+
- _get_win_folder = _get_win_folder_with_ctypes
17+
+ import com.sun.jna
18+
+ _get_win_folder = _get_win_folder_with_jna
19+
except ImportError:
20+
- try:
21+
- import com.sun.jna
22+
- _get_win_folder = _get_win_folder_with_jna
23+
- except ImportError:
24+
- _get_win_folder = _get_win_folder_from_registry
25+
+ _get_win_folder = _get_win_folder_from_registry
26+
27+
28+
#---- self test code

0 commit comments

Comments
 (0)