@@ -577,6 +577,8 @@ def git_get_keywords(versionfile_abs):
577
577
f.close()
578
578
except EnvironmentError:
579
579
pass
580
+ # CJM: Nibabel hack to ensure we can git-archive off-release versions and
581
+ # revert to old X.Y.Zdev versions + githash
580
582
try:
581
583
rel = runpy.run_path(os.path.join(os.path.dirname(versionfile_abs), "info.py"))
582
584
keywords["fallback"] = rel["VERSION"]
@@ -588,8 +590,9 @@ def git_get_keywords(versionfile_abs):
588
590
@register_vcs_handler("git", "keywords")
589
591
def git_versions_from_keywords(keywords, tag_prefix, verbose):
590
592
"""Get version information from git keywords."""
591
- if not keywords:
592
- raise NotThisMethod("no keywords at all, weird")
593
+ # CJM: Nibabel fix to avoid hitting unguarded dictionary lookup, better explanation
594
+ if "refnames" not in keywords:
595
+ raise NotThisMethod("Short version file found")
593
596
date = keywords.get("date")
594
597
if date is not None:
595
598
# git-2.2.0 added "%%cI", which expands to an ISO-8601 -compliant
@@ -974,6 +977,8 @@ def git_get_keywords(versionfile_abs):
974
977
f .close ()
975
978
except EnvironmentError :
976
979
pass
980
+ # CJM: Nibabel hack to ensure we can git-archive off-release versions and
981
+ # revert to old X.Y.Zdev versions + githash
977
982
try :
978
983
rel = runpy .run_path (os .path .join (os .path .dirname (versionfile_abs ), "info.py" ))
979
984
keywords ["fallback" ] = rel ["VERSION" ]
@@ -985,8 +990,9 @@ def git_get_keywords(versionfile_abs):
985
990
@register_vcs_handler ("git" , "keywords" )
986
991
def git_versions_from_keywords (keywords , tag_prefix , verbose ):
987
992
"""Get version information from git keywords."""
988
- if not keywords :
989
- raise NotThisMethod ("no keywords at all, weird" )
993
+ # CJM: Nibabel fix to avoid hitting unguarded dictionary lookup, better explanation
994
+ if "refnames" not in keywords :
995
+ raise NotThisMethod ("Short version file found" )
990
996
date = keywords .get ("date" )
991
997
if date is not None :
992
998
# git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
0 commit comments