def version_check_and_info(module):
"""Return either git info or standard module version if not a git repo.
Args:
module (module): python module object to get info for.
Returns:
dict: dictionary of info
"""
srcpath = inspect.getsourcefile(module)
try:
repo = git.Repo(srcpath, search_parent_directories=True)
except git.InvalidGitRepositoryError:
log.info('module %s not in a git repo, checking package version' %
module.__name__)
info = version_info(module)
else:
info = git_info(repo)
info['source_path'] = srcpath
return info
评论列表
文章目录