fix missing encodings

These were caught by the testsuite erroring out with a fatal
EncodingWarning due to the previous commit.

Fixes #9996
pull/10050/head
Eli Schwartz 3 years ago
parent a6e08e8fa7
commit 4934b9968a
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 6
      mesonbuild/coredata.py
  2. 2
      mesonbuild/wrap/wrap.py

@ -43,6 +43,9 @@ if T.TYPE_CHECKING:
KeyedOptionDictType = T.Union[T.Dict['OptionKey', 'UserOption[T.Any]'], OptionOverrideProxy]
CompilerCheckCacheKey = T.Tuple[T.Tuple[str, ...], str, FileOrString, T.Tuple[str, ...], str]
# typeshed
StrOrBytesPath = T.Union[str, bytes, os.PathLike[str], os.PathLike[bytes]]
# Check major_versions_differ() if changing versioning scheme.
#
# Pip requires that RCs are named like this: '0.1.0.rc1'
@ -895,6 +898,9 @@ class CmdLineFileParser(configparser.ConfigParser):
# storing subproject options like "subproject:option=value"
super().__init__(delimiters=['='], interpolation=None)
def read(self, filenames: T.Union['StrOrBytesPath', T.Iterable['StrOrBytesPath']], encoding: str ='utf-8') -> T.List[str]:
return super().read(filenames, encoding)
def optionxform(self, option: str) -> str:
# Don't call str.lower() on keys
return option

@ -121,7 +121,7 @@ class PackageDefinition:
def parse_wrap(self) -> None:
try:
config = configparser.ConfigParser(interpolation=None)
config.read(self.filename)
config.read(self.filename, encoding='utf-8')
except configparser.Error as e:
raise WrapException(f'Failed to parse {self.basename}: {e!s}')
self.parse_wrap_section(config)

Loading…
Cancel
Save