diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-01-17 15:51:37 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-01-17 21:04:21 +0000 |
commit | efe7270429ae13bdce58835998303d969a6f6df7 (patch) | |
tree | 3b139cd374dfbf590c2088b153b7977dd0ef1380 | |
parent | a3d8dc546c1a83f9e99f729ed5966d0e95581ac2 (diff) | |
download | meson-efe7270429ae13bdce58835998303d969a6f6df7.zip meson-efe7270429ae13bdce58835998303d969a6f6df7.tar.gz meson-efe7270429ae13bdce58835998303d969a6f6df7.tar.bz2 |
Do not store config parser object in Wrap object. Closes: #7920.
-rw-r--r-- | mesonbuild/wrap/wrap.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index bb153c5..34e58e3 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -114,11 +114,11 @@ class PackageDefinition: def parse_wrap(self) -> None: try: - self.config = configparser.ConfigParser(interpolation=None) - self.config.read(self.filename) + config = configparser.ConfigParser(interpolation=None) + config.read(self.filename) except configparser.Error as e: raise WrapException('Failed to parse {}: {}'.format(self.basename, str(e))) - self.parse_wrap_section() + self.parse_wrap_section(config) if self.type == 'redirect': # [wrap-redirect] have a `filename` value pointing to the real wrap # file we should parse instead. It must be relative to the current @@ -140,21 +140,21 @@ class PackageDefinition: self.filename = str(fname) self.parse_wrap() return - self.parse_provide_section() + self.parse_provide_section(config) - def parse_wrap_section(self) -> None: - if len(self.config.sections()) < 1: + def parse_wrap_section(self, config: configparser.ConfigParser) -> None: + if len(config.sections()) < 1: raise WrapException('Missing sections in {}'.format(self.basename)) - self.wrap_section = self.config.sections()[0] + self.wrap_section = config.sections()[0] if not self.wrap_section.startswith('wrap-'): m = '{!r} is not a valid first section in {}' raise WrapException(m.format(self.wrap_section, self.basename)) self.type = self.wrap_section[5:] - self.values = dict(self.config[self.wrap_section]) + self.values = dict(config[self.wrap_section]) - def parse_provide_section(self) -> None: - if self.config.has_section('provide'): - for k, v in self.config['provide'].items(): + def parse_provide_section(self, config: configparser.ConfigParser) -> None: + if config.has_section('provide'): + for k, v in config['provide'].items(): if k == 'dependency_names': # A comma separated list of dependency names that does not # need a variable name |