diff options
author | Brian Harring <ferringb@gmail.com> | 2023-01-17 01:25:41 -0800 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-02-05 20:08:21 +0200 |
commit | 39c0c1296c5ae08827c12a71484f6aaca9187e17 (patch) | |
tree | 9179300c262286cd0e46d9973aeb2f6959992a80 /src | |
parent | fix(config): Add deprecation warnings for very old config shims (diff) | |
download | pkgcore-39c0c1296c5ae08827c12a71484f6aaca9187e17.tar.gz pkgcore-39c0c1296c5ae08827c12a71484f6aaca9187e17.tar.bz2 pkgcore-39c0c1296c5ae08827c12a71484f6aaca9187e17.zip |
fix(config): cleanup deprecated access of central.*, using central.objects.* instead
See the last commit for particulars, or fa90aff05306fb4935604e64645f2d1d2049233e .
This just completes the migration for what I can find.
Signed-off-by: Brian Harring <ferringb@gmail.com>
Closes: https://github.com/pkgcore/pkgcore/pull/398
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pkgcore/scripts/pconfig.py | 2 | ||||
-rw-r--r-- | src/pkgcore/scripts/pmerge.py | 8 | ||||
-rw-r--r-- | src/pkgcore/util/commandline.py | 4 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/pkgcore/scripts/pconfig.py b/src/pkgcore/scripts/pconfig.py index 75bb0017..9db37634 100644 --- a/src/pkgcore/scripts/pconfig.py +++ b/src/pkgcore/scripts/pconfig.py @@ -239,7 +239,7 @@ def dump_main(options, out, err): if options.typename is None: names = config.sections() else: - names = iter(getattr(config, options.typename).keys()) + names = iter(getattr(config.objects, options.typename).keys()) for i, name in enumerate(sorted(names)): if i > 0: out.write() diff --git a/src/pkgcore/scripts/pmerge.py b/src/pkgcore/scripts/pmerge.py index 6d21bc53..7949f5b0 100644 --- a/src/pkgcore/scripts/pmerge.py +++ b/src/pkgcore/scripts/pmerge.py @@ -648,7 +648,7 @@ def _validate(parser, namespace): parser.error("-O/--nodeps cannot be used with -o/--onlydeps (it's a no-op)") if namespace.sets: - unknown_sets = set(namespace.sets).difference(namespace.config.pkgset) + unknown_sets = set(namespace.sets).difference(namespace.config.objects.pkgset) if unknown_sets: parser.error( "unknown set%s: %s (available sets: %s)" @@ -658,7 +658,9 @@ def _validate(parser, namespace): ", ".join(sorted(namespace.config.pkgset)), ) ) - namespace.sets = [(x, namespace.config.pkgset[x]) for x in namespace.sets] + namespace.sets = [ + (x, namespace.config.objects.pkgset[x]) for x in namespace.sets + ] if namespace.upgrade or namespace.downgrade: namespace.replace = False if not namespace.targets and not namespace.sets: @@ -738,7 +740,7 @@ def parse_target(restriction, repo, installed_repos, return_none=False): @argparser.bind_delayed_default(50, name="world") def load_world(namespace, attr): - value = namespace.config.pkgset["world"] + value = namespace.config.objects.pkgset["world"] setattr(namespace, attr, value) diff --git a/src/pkgcore/util/commandline.py b/src/pkgcore/util/commandline.py index c7df89c9..d7e47ded 100644 --- a/src/pkgcore/util/commandline.py +++ b/src/pkgcore/util/commandline.py @@ -197,7 +197,7 @@ class StoreConfigObject(argparse._StoreAction): ) def _get_sections(self, config, namespace): - return getattr(config, self.config_type) + return getattr(config.objects, self.config_type) def _real_call(self, parser, namespace, values, option_string=None): config = getattr(namespace, "config", None) @@ -226,7 +226,7 @@ class StoreConfigObject(argparse._StoreAction): ) obj = config.get_default(config_type) if obj is None: - known_objs = sorted(getattr(config, config_type).keys()) + known_objs = sorted(getattr(config.objects, config_type).keys()) msg = f"config error: no default object of type {config_type!r} found. " if not option_string: msg += "Please fix your configuration." |