commit:     816e3dee8d048386e753d7c0b618609b5489d25e
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  2 10:30:46 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Dec 18 18:58:27 2022 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=816e3dee

remove dependence on plugincache generation

Resolves: https://github.com/pkgcore/pkgcore/issues/376
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 py_build.py              | 15 ++++-----------
 src/pkgcore/test/misc.py | 27 ++-------------------------
 2 files changed, 6 insertions(+), 36 deletions(-)

diff --git a/py_build.py b/py_build.py
index 1a5a4559e..48394046f 100644
--- a/py_build.py
+++ b/py_build.py
@@ -50,19 +50,12 @@ def write_verinfo(cleanup_files):
     path.write_text(f"version_info={get_git_version(Path.cwd())!r}")
 
 
-def prepare_pkgcore(callback, consts: bool, plugincache: bool):
+def prepare_pkgcore(callback, consts: bool):
     cleanup_files = []
     try:
         with sys_path():
             write_verinfo(cleanup_files)
 
-            # Install module plugincache
-            if plugincache:
-                from pkgcore import plugin, plugins
-                print('Generating plugin cache')
-                cleanup_files.append(path := Path.cwd() / 
"src/pkgcore/plugins")
-                plugin.initialize_cache(plugins, force=True, cache_dir=path)
-
             # Install configuration data so pkgcore knows where to find its 
content,
             # rather than assuming it is running from a tarball/git repo.
             if consts:
@@ -84,16 +77,16 @@ def prepare_pkgcore(callback, consts: bool, plugincache: 
bool):
 def build_wheel(wheel_directory, config_settings=None, 
metadata_directory=None):
     """Builds a wheel, places it in wheel_directory"""
     callback = partial(buildapi.build_wheel, wheel_directory, config_settings, 
metadata_directory)
-    return prepare_pkgcore(callback, consts=True, plugincache=True)
+    return prepare_pkgcore(callback, consts=True)
 
 
 def build_editable(wheel_directory, config_settings=None, 
metadata_directory=None):
     """Builds an "editable" wheel, places it in wheel_directory"""
     callback = partial(buildapi.build_editable, wheel_directory, 
config_settings, metadata_directory)
-    return prepare_pkgcore(callback, consts=False, plugincache=True)
+    return prepare_pkgcore(callback, consts=False)
 
 
 def build_sdist(sdist_directory, config_settings=None):
     """Builds an sdist, places it in sdist_directory"""
     callback = partial(buildapi.build_sdist, sdist_directory, config_settings)
-    return prepare_pkgcore(callback, consts=False, plugincache=False)
+    return prepare_pkgcore(callback, consts=False)

diff --git a/src/pkgcore/test/misc.py b/src/pkgcore/test/misc.py
index d5969d2f0..d73da12ce 100644
--- a/src/pkgcore/test/misc.py
+++ b/src/pkgcore/test/misc.py
@@ -2,7 +2,6 @@
 
 from snakeoil.mappings import AttrAccessible
 
-from .. import plugin
 from ..ebuild.atom import atom
 from ..ebuild.conditionals import DepSet
 from ..ebuild.cpv import CPV
@@ -14,7 +13,7 @@ from ..package.metadata import factory
 from ..repository.util import SimpleTree
 from ..restrictions import packages
 
-default_arches = set(["x86", "ppc", "amd64", "ia64"])
+default_arches = {"x86", "ppc", "amd64", "ia64"}
 
 Options = AttrAccessible
 
@@ -88,7 +87,7 @@ class FakeRepo:
     def __contains__(self, obj):
         """Determine if a path or a package is in a repo."""
         if isinstance(obj, str):
-            if self.location and path.startswith(self.location):
+            if self.location and obj.startswith(self.location):
                 return True
             return False
         else:
@@ -127,28 +126,6 @@ class FakePkg(FakePkgBase):
             object.__setattr__(self, "iuse", set(iuse))
 
 
-class DisablePlugins:
-
-    default_state = {}
-    wipe_plugin_state = True
-
-    def force_plugin_state(self, wipe=True, **packages):
-        if wipe:
-            plugin._cache.clear()
-        plugin._cache.update(packages)
-
-    def setUp(self):
-        self._plugin_orig_initialize = plugin.initialize_cache
-        self._plugin_orig_cache = plugin._cache.copy()
-        if self.wipe_plugin_state:
-            plugin._cache = {}
-        plugin.initialize_cache = lambda p: ()
-
-    def tearDown(self):
-        plugin._cache = self._plugin_orig_cache
-        plugin.initialize_cache = self._plugin_orig_initialize
-
-
 # misc setup code for generating glsas for testing
 
 glsa_template = \

Reply via email to