1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Merge pull request #4992 from pradyunsg/vendor/disable-appdirs-loading-c-library

Disable vendored appdirs loading C library
This commit is contained in:
Pradyun Gedam 2018-01-24 16:35:35 +05:30 committed by GitHub
commit 1ea3f89ff9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 12 deletions

View file

@ -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

View file

@ -1 +0,0 @@
from appdirs import *

View file

@ -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:

View file

@ -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