commit: c3328311da9b91072b4cc00bc5cd90b073bca61e Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> AuthorDate: Sat Jan 11 01:16:57 2025 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Sat Jan 11 01:59:11 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c3328311
portage.VERSION: prevent infinite recursion when lazy loading If we are running Portage from a git checkout but the git command is unavailable or broken, we never set the VERSION variable. Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> lib/portage/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py index 10c303477f..4bde4886b0 100644 --- a/lib/portage/__init__.py +++ b/lib/portage/__init__.py @@ -715,6 +715,7 @@ if installation.TYPE == installation.TYPES.SOURCE: global VERSION if VERSION is not self: return VERSION + VERSION = "HEAD" if os.path.isdir(os.path.join(PORTAGE_BASE_PATH, ".git")): encoding = _encodings["fs"] cmd = [ @@ -734,8 +735,6 @@ if installation.TYPE == installation.TYPES.SOURCE: status = proc.wait() if os.WIFEXITED(status) and os.WEXITSTATUS(status) == os.EX_OK: VERSION = output.lstrip("portage-").strip().replace("-g", "+g") - else: - VERSION = "HEAD" return VERSION VERSION = _LazyVersion()