From b8a22d672a309976fcdc856269921a32414fdac5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 9 Dec 2011 22:13:29 -0800 Subject: [PATCH] config: make eprefix constructor parameter public --- bin/egencache | 4 ++-- bin/repoman | 8 ++++---- pym/portage/__init__.py | 4 ++-- pym/portage/package/ebuild/config.py | 10 +++------- pym/portage/tests/dbapi/test_fakedbapi.py | 2 +- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/bin/egencache b/bin/egencache index 532cc034c..6d18f66e5 100755 --- a/bin/egencache +++ b/bin/egencache @@ -844,7 +844,7 @@ def egencache_main(args): eprefix = portage.const.EPREFIX settings = portage.config(config_root=config_root, - local_config=False, env=env, _eprefix=eprefix) + local_config=False, env=env, eprefix=eprefix) default_opts = None if not options.ignore_default_opts: @@ -857,7 +857,7 @@ def egencache_main(args): env['PORTAGE_DEPCACHEDIR'] = options.cache_dir settings = portage.config(config_root=config_root, - local_config=False, env=env, _eprefix=eprefix) + local_config=False, env=env, eprefix=eprefix) if not options.update and not options.update_use_local_desc \ and not options.update_changelogs: diff --git a/bin/repoman b/bin/repoman index 6ea15678d..24e8f77b6 100755 --- a/bin/repoman +++ b/bin/repoman @@ -96,7 +96,7 @@ os.umask(0o22) repoman_incrementals = tuple(x for x in \ portage.const.INCREMENTALS if x != 'ACCEPT_KEYWORDS') eprefix = portage.const.EPREFIX -repoman_settings = portage.config(local_config=False, _eprefix=eprefix) +repoman_settings = portage.config(local_config=False, eprefix=eprefix) repoman_settings.lock() if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \ @@ -565,13 +565,13 @@ if options.mode == 'commit' and not options.pretend and not vcs: options.pretend = True # Ensure that PORTDIR_OVERLAY contains the repository corresponding to $PWD. -repoman_settings = portage.config(local_config=False, _eprefix=eprefix) +repoman_settings = portage.config(local_config=False, eprefix=eprefix) repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % \ (repoman_settings.get('PORTDIR_OVERLAY', ''), portage._shell_quote(portdir_overlay)) # We have to call the config constructor again so # that config.repositories is initialized correctly. -repoman_settings = portage.config(local_config=False, _eprefix=eprefix, +repoman_settings = portage.config(local_config=False, eprefix=eprefix, env=dict(os.environ, PORTDIR_OVERLAY=repoman_settings['PORTDIR_OVERLAY'])) root = repoman_settings['EROOT'] @@ -2005,7 +2005,7 @@ for x in effective_scanlist: config_incrementals=repoman_incrementals, local_config=False, _unmatched_removal=options.unmatched_removal, - env=env, _eprefix=eprefix) + env=env, eprefix=eprefix) dep_settings.categories = repoman_settings.categories if options.without_mask: dep_settings._mask_manager = \ diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index bdfb4e29d..5a1866ff1 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -508,7 +508,7 @@ def create_trees(config_root=None, target_root=None, trees=None, env=None): if eprefix is None: eprefix = portage.const.EPREFIX settings = config(config_root=config_root, target_root=target_root, - env=env, _eprefix=eprefix) + env=env, eprefix=eprefix) settings.lock() trees._target_eroot = settings['EROOT'] @@ -528,7 +528,7 @@ def create_trees(config_root=None, target_root=None, trees=None, env=None): if v is not None: clean_env[k] = v settings = config(config_root=None, target_root="/", - env=clean_env, _eprefix=eprefix) + env=clean_env, eprefix=eprefix) settings.lock() trees._running_eroot = settings['EROOT'] myroots.append((settings['EROOT'], settings)) diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 40a61a43a..87cefee61 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -143,7 +143,7 @@ class config(object): def __init__(self, clone=None, mycpv=None, config_profile_path=None, config_incrementals=None, config_root=None, target_root=None, - _eprefix=portage.const.EPREFIX, local_config=True, env=None, + eprefix=portage.const.EPREFIX, local_config=True, env=None, _unmatched_removal=False): """ @param clone: If provided, init will use deepcopy to copy by value the instance. @@ -160,8 +160,8 @@ class config(object): @type config_root: String @param target_root: __init__ override of $ROOT env variable. @type target_root: String - @param _eprefix: set the EPREFIX variable (private, used by internal tests) - @type _eprefix: String + @param eprefix: set the EPREFIX variable + @type eprefix: String @param local_config: Enables loading of local config (/etc/portage); used most by repoman to ignore local config (keywording and unmasking) @type local_config: Boolean @@ -173,10 +173,6 @@ class config(object): @type _unmatched_removal: Boolean """ - # rename local _eprefix variable for convenience - eprefix = _eprefix - del _eprefix - # When initializing the global portage.settings instance, avoid # raising exceptions whenever possible since exceptions thrown # from 'import portage' or 'import portage.exceptions' statements diff --git a/pym/portage/tests/dbapi/test_fakedbapi.py b/pym/portage/tests/dbapi/test_fakedbapi.py index a2c5f778e..cfef94e26 100644 --- a/pym/portage/tests/dbapi/test_fakedbapi.py +++ b/pym/portage/tests/dbapi/test_fakedbapi.py @@ -48,7 +48,7 @@ class TestFakedbapi(TestCase): "PORTDIR": portdir, } fakedb = fakedbapi(settings=config(config_profile_path="", - env=env, _eprefix=tempdir)) + env=env, eprefix=tempdir)) for cpv, metadata in packages: fakedb.cpv_inject(cpv, metadata=metadata) -- 2.26.2