From 1fa83a952fccb27a2b3f3f428e23aa7e5cb808cc Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 14 Mar 2018 16:44:27 -0400 Subject: [PATCH] fix for loading git revision from dev-tree without installed version of loopy --- loopy/version.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/loopy/version.py b/loopy/version.py index 2f29e806e..965baf092 100644 --- a/loopy/version.py +++ b/loopy/version.py @@ -29,13 +29,18 @@ if os.environ.get("AKPYTHON_EXEC_IMPORT_UNAVAILABLE") is not None: _git_rev = None else: - import loopy._git_rev as _git_rev_mod - _git_rev = _git_rev_mod.GIT_REVISION + try: + import loopy._git_rev as _git_rev_mod + _git_rev = _git_rev_mod.GIT_REVISION + except ImportError: + _git_rev = None # If we're running from a dev tree, the last install (and hence the most # recent update of the above git rev) could have taken place very long ago. from pytools import find_module_git_revision _runtime_git_rev = find_module_git_revision(__file__, n_levels_up=1) + if _git_rev is None and _runtime_git_rev is None: + raise Exception("Cannot determine git revision from install or dev-tree.") if _runtime_git_rev is not None: _git_rev = _runtime_git_rev -- GitLab