diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-12-10 14:33:42 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-12-10 14:33:42 -0800 |
commit | b5f17cb8bcdf5df5784add95fe7079cea64d4461 (patch) | |
tree | 977d9b8fc56b2d55d3e4bd9c77e6c170b055fef7 | |
parent | e51bcea18af2d08b2b608bb70e9e81f9f4ca16e9 (diff) | |
download | portage-b5f17cb8bcdf5df5784add95fe7079cea64d4461.tar.gz portage-b5f17cb8bcdf5df5784add95fe7079cea64d4461.tar.bz2 portage-b5f17cb8bcdf5df5784add95fe7079cea64d4461.zip |
config: init data/output modules in constructor
The first constructed config object initializes these modules, and
subsequent calls to the _init() functions have no effect.
-rw-r--r-- | pym/_emerge/actions.py | 4 | ||||
-rw-r--r-- | pym/portage/_legacy_globals.py | 2 | ||||
-rw-r--r-- | pym/portage/data.py | 5 | ||||
-rw-r--r-- | pym/portage/package/ebuild/config.py | 5 |
4 files changed, 8 insertions, 8 deletions
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 7150c2363..484f6b09b 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -2990,10 +2990,6 @@ def load_emerge_config(trees=None): settings = trees[trees._target_eroot]['vartree'].settings mtimedbfile = os.path.join(settings['EROOT'], portage.CACHE_PATH, "mtimedb") mtimedb = portage.MtimeDB(mtimedbfile) - portage.output._init(config_root=settings['PORTAGE_CONFIGROOT']) - # The portage_uid initialization here must happen before - # the _init_dirs() calls below. - portage.data._init(settings) QueryCommand._db = trees for root, root_trees in trees.items(): diff --git a/pym/portage/_legacy_globals.py b/pym/portage/_legacy_globals.py index e818e7e7a..abffa0e9a 100644 --- a/pym/portage/_legacy_globals.py +++ b/pym/portage/_legacy_globals.py @@ -36,8 +36,6 @@ def _get_legacy_global(name): del portage._initializing_globals settings = portage.db[portage.db._target_eroot]["vartree"].settings - portage.output._init(config_root=settings['PORTAGE_CONFIGROOT']) - portage.data._init(settings) portage.settings = settings constructed.add('settings') diff --git a/pym/portage/data.py b/pym/portage/data.py index 53af6b966..7c1733445 100644 --- a/pym/portage/data.py +++ b/pym/portage/data.py @@ -169,13 +169,14 @@ def _init(settings): initialize global variables. This allows settings to come from make.conf instead of requiring them to be set in the calling environment. """ - if '_portage_grpname' not in _initialized_globals: + if '_portage_grpname' not in _initialized_globals and \ + '_portage_uname' not in _initialized_globals: + v = settings.get('PORTAGE_GRPNAME') if v is not None: globals()['_portage_grpname'] = v _initialized_globals.add('_portage_grpname') - if '_portage_uname' not in _initialized_globals: v = settings.get('PORTAGE_USERNAME') if v is not None: globals()['_portage_uname'] = v diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 7fb4ff096..21af0de76 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -789,6 +789,11 @@ class config(object): self[k] = self[k].lower() self.backup_changes(k) + # The first constructed config object initializes these modules, + # and subsequent calls to the _init() functions have no effect. + portage.output._init(config_root=self['PORTAGE_CONFIGROOT']) + portage.data._init(self) + if mycpv: self.setcpv(mycpv) |