commit:     39c0c1296c5ae08827c12a71484f6aaca9187e17
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Tue Jan 17 09:25:41 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Feb  5 18:08:21 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=39c0c129

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 <AT> gmail.com>
Closes: https://github.com/pkgcore/pkgcore/pull/398
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcore/scripts/pconfig.py  | 2 +-
 src/pkgcore/scripts/pmerge.py   | 8 +++++---
 src/pkgcore/util/commandline.py | 4 ++--
 tests/config/test_init.py       | 8 ++++----
 tests/scripts/test_pmaint.py    | 2 +-
 5 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/pkgcore/scripts/pconfig.py b/src/pkgcore/scripts/pconfig.py
index 75bb00171..9db37634b 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 6d21bc53e..7949f5b0c 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 c7df89c97..d7e47dedf 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."

diff --git a/tests/config/test_init.py b/tests/config/test_init.py
index 1ac35e8eb..c3cfbac86 100644
--- a/tests/config/test_init.py
+++ b/tests/config/test_init.py
@@ -26,13 +26,13 @@ class TestConfigLoading:
 
     def test_load_config(self, user_config):
         manager = load_config(user_conf_file=user_config)
-        assert manager.foo["foo"] == ((), {})
+        assert manager.objects.foo["foo"] == ((), {})
 
     def test_user_config_override_system(self, user_config, system_config):
         manager = load_config(
             user_conf_file=user_config, system_conf_file=system_config
         )
-        assert manager.foo["foo"] == ((), {})
+        assert manager.objects.foo["foo"] == ((), {})
 
     def test_prepends(self, user_config):
         manager = load_config(
@@ -41,9 +41,9 @@ class TestConfigLoading:
                 {"myfoo": basics.HardCodedConfigSection({"inherit": ["foo"]})}
             ],
         )
-        assert manager.foo["myfoo"] == ((), {})
+        assert manager.objects.foo["myfoo"] == ((), {})
 
     def test_disabling_loading(self, user_config):
         manager = load_config(user_conf_file=user_config, 
skip_config_files=True)
         with pytest.raises(KeyError):
-            manager.foo["foo"]
+            manager.objects.foo["foo"]

diff --git a/tests/scripts/test_pmaint.py b/tests/scripts/test_pmaint.py
index 945ef0dd3..123421016 100644
--- a/tests/scripts/test_pmaint.py
+++ b/tests/scripts/test_pmaint.py
@@ -134,7 +134,7 @@ class TestSync(ArgParseMixin):
             ],
             myrepo=success_section,
         )
-        assert config.repo_config["myrepo"]._syncer.synced
+        assert config.objects.repo_config["myrepo"]._syncer.synced
         self.assertOut(
             [
                 "*** syncing myrepo",

Reply via email to