aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2016-06-09 00:34:08 -0400
committerTim Harder <radhermit@gmail.com>2016-06-09 02:05:46 -0400
commitad9fa6b5da365636d537d1325ef659b1fe7bd2ad (patch)
tree2034834628e63d6d0cd0fc37da3f5014f5e91c97
parentebuild/repository: _UnconfiguredTree: set empty masters (diff)
downloadpkgcore-ad9fa6b5da365636d537d1325ef659b1fe7bd2ad.tar.gz
pkgcore-ad9fa6b5da365636d537d1325ef659b1fe7bd2ad.tar.bz2
pkgcore-ad9fa6b5da365636d537d1325ef659b1fe7bd2ad.zip
config: fix importing global config settings for external projects
Previously the pkgconfig global config options were always getting imported instead of the pkgcheck ones even when pkgcheck was being run.
-rw-r--r--pkgcore/config/__init__.py2
-rw-r--r--pkgcore/util/commandline.py12
2 files changed, 9 insertions, 5 deletions
diff --git a/pkgcore/config/__init__.py b/pkgcore/config/__init__.py
index 39dbfb253..cdf5f73fa 100644
--- a/pkgcore/config/__init__.py
+++ b/pkgcore/config/__init__.py
@@ -21,7 +21,6 @@ demandload(
'pkgcore.config:central,cparser',
'pkgcore.ebuild.portage_conf:config_from_make_conf',
'pkgcore.log:logger',
- 'pkgcore.plugin:get_plugins',
)
@@ -82,7 +81,6 @@ def load_config(user_conf_file=const.USER_CONF_FILE,
:obj:`pkgcore.config.central.ConfigManager` instance: system config
"""
configs = list(prepend_sources)
- configs.extend(get_plugins('global_config'))
if not skip_config_files:
# load a pkgcore config file if one exists
for config in (location,
diff --git a/pkgcore/util/commandline.py b/pkgcore/util/commandline.py
index 2c991efa8..6108ce184 100644
--- a/pkgcore/util/commandline.py
+++ b/pkgcore/util/commandline.py
@@ -39,6 +39,7 @@ demandload(
'snakeoil.sequences:iflatten_instance,unstable_unique',
'pkgcore:operations',
'pkgcore.config:basics',
+ 'pkgcore.plugin:get_plugins',
'pkgcore.restrictions:packages,restriction',
'pkgcore.util:parserestrict',
)
@@ -460,7 +461,7 @@ def _convert_config_mods(iterable):
return d
-def store_config(namespace, attr):
+def store_config(project, namespace, attr):
configs = map(
_convert_config_mods, [namespace.new_config, namespace.add_config])
# add necessary inherits for add_config
@@ -471,8 +472,13 @@ def store_config(namespace, attr):
for section, vals in d.iteritems()}
for d in configs if d]
+ # XXX: Figure out a better method for plugin registry/loading.
+ module_plugins = import_module('.plugins', project)
+ global_config = get_plugins('global_config', module_plugins)
+
config = load_config(
skip_config_files=namespace.empty_config,
+ prepend_sources=tuple(global_config),
append_sources=tuple(configs),
location=namespace.override_config,
**vars(namespace))
@@ -488,7 +494,7 @@ def _mk_domain(parser):
class ArgumentParser(arghparse.ArgumentParser):
- def __init__(self, config=True, domain=True, **kwds):
+ def __init__(self, config=True, domain=True, project=__name__.split('.')[0], **kwds):
super(ArgumentParser, self).__init__(**kwds)
if not self.suppress:
@@ -509,7 +515,7 @@ class ArgumentParser(arghparse.ArgumentParser):
type=arghparse.existent_path,
help='override location of config files')
- self.set_defaults(config=arghparse.DelayedValue(store_config, 0))
+ self.set_defaults(config=arghparse.DelayedValue(partial(store_config, project), 0))
if domain:
_mk_domain(self)