commit: 53e88f6225b157397a7167c91697db27a0b3d8b7 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sat Nov 22 09:21:21 2025 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Thu Nov 27 05:16:22 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=53e88f62
update.py: Replace lazyimport with function local import Bug: https://bugs.gentoo.org/951146 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/portage/update.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/portage/update.py b/lib/portage/update.py index b996d511eb..6fbcc77477 100644 --- a/lib/portage/update.py +++ b/lib/portage/update.py @@ -11,15 +11,6 @@ from portage import os from portage import _encodings from portage import _unicode_decode from portage import _unicode_encode -import portage - -portage.proxy.lazyimport.lazyimport( - globals(), - "portage.dep:Atom,dep_getkey,isvalidatom,match_from_list", - "portage.util:ConfigProtect,new_protect_filename," - + "normalize_path,write_atomic,writemsg", - "portage.versions:_get_slot_re", -) from portage.const import USER_CONFIG_PATH, VCS_DIRS from portage.eapi import _get_eapi_attrs @@ -31,6 +22,8 @@ ignored_dbentries = ("CONTENTS", "environment.bz2") def update_dbentry(update_cmd, mycontent, eapi=None, parent=None): + from portage.dep import Atom, isvalidatom, match_from_list + if parent is not None: eapi = parent.eapi @@ -147,6 +140,7 @@ def fixdbentries(update_iter, dbdir, eapi=None, parent=None): """Performs update commands which result in search and replace operations for each of the files in dbdir (excluding CONTENTS and environment.bz2). Returns True when actual modifications are necessary and False otherwise.""" + from portage.util import write_atomic warnings.warn( "portage.update.fixdbentries() is deprecated", DeprecationWarning, stacklevel=2 @@ -210,6 +204,9 @@ def grab_updates(updpath, prev_mtimes=None): def parse_updates(mycontent): """Valid updates are returned as a list of split update commands.""" + from portage.dep import Atom + from portage.versions import _get_slot_re + eapi_attrs = _get_eapi_attrs(None) slot_re = _get_slot_re(eapi_attrs) myupd = [] @@ -300,6 +297,14 @@ def update_config_files( match_callback - a callback which will be called with three arguments: match_callback(repo_name, old_atom, new_atom) and should return boolean value determining whether to perform the update""" + from portage.dep import isvalidatom + from portage.util import ( + ConfigProtect, + new_protect_filename, + normalize_path, + write_atomic, + writemsg, + ) repo_dict = None if isinstance(update_iter, dict): @@ -457,6 +462,8 @@ def update_config_files( def dep_transform(mydep, oldkey, newkey): + from portage.dep import dep_getkey + if dep_getkey(mydep) == oldkey: return mydep.replace(oldkey, newkey, 1) return mydep
