diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-03-01 19:06:30 -0500 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2022-03-11 13:45:37 +0530 |
commit | 46ff69e11d3c6be2a40f0dc2e8003ad7e0e38ddc (patch) | |
tree | 5a7e46eac3970ba5b8f9118bb458854b95ca3a50 | |
parent | d9109669913a595781017eb312cbf62015a7c551 (diff) | |
download | meson-46ff69e11d3c6be2a40f0dc2e8003ad7e0e38ddc.zip meson-46ff69e11d3c6be2a40f0dc2e8003ad7e0e38ddc.tar.gz meson-46ff69e11d3c6be2a40f0dc2e8003ad7e0e38ddc.tar.bz2 |
fix missing encodings
These were caught by the testsuite erroring out with a fatal
EncodingWarning due to the previous commit.
Fixes #9996
-rw-r--r-- | mesonbuild/coredata.py | 6 | ||||
-rw-r--r-- | mesonbuild/wrap/wrap.py | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 7e4d9c0..d18af59 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.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' @@ -897,6 +900,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 diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index f2b59bd..c25488c 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -118,7 +118,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) |