File tree 2 files changed +13
-1
lines changed
src/pip/_internal/locations 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change
1
+ Skip distutils configuration parsing on encoding errors.
Original file line number Diff line number Diff line change 3
3
# The following comment should be removed at some point in the future.
4
4
# mypy: strict-optional=False
5
5
6
+ import logging
6
7
import os
7
8
import sys
8
9
from distutils .cmd import Command as DistutilsCommand
17
18
18
19
from .base import get_major_minor_version
19
20
21
+ logger = logging .getLogger (__name__ )
22
+
20
23
21
24
def _distutils_scheme (
22
25
dist_name : str ,
@@ -36,7 +39,15 @@ def _distutils_scheme(
36
39
dist_args ["script_args" ] = ["--no-user-cfg" ]
37
40
38
41
d = Distribution (dist_args )
39
- d .parse_config_files ()
42
+ try :
43
+ d .parse_config_files ()
44
+ except UnicodeDecodeError :
45
+ # Typeshed does not include find_config_files() for some reason.
46
+ paths = d .find_config_files () # type: ignore
47
+ logger .warning (
48
+ "Ignore distutils configs in %s due to encoding errors." ,
49
+ ", " .join (os .path .basename (p ) for p in paths ),
50
+ )
40
51
obj : Optional [DistutilsCommand ] = None
41
52
obj = d .get_command_obj ("install" , create = True )
42
53
assert obj is not None
You can’t perform that action at this time.
0 commit comments