From fbcb5907d8458e18f249740ddb7774b316c6a534 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Tue, 24 Nov 2020 11:27:22 +0100 Subject: [PATCH] fix: python error if no tag is found Using the default_config with only 'starting_version' set in a repository without tags the following error was raised: ... File "../project/.eggs/setuptools_git_versioning-1.2.6-py3.7.egg/setuptools_git_versioning.py", line 156, in version_from_git if not os.path.exists(version_file): File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/genericpath.py", line 19, in exists os.stat(path) TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType ``` Python 3.7.3 (on MacOS) --- setuptools_git_versioning.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools_git_versioning.py b/setuptools_git_versioning.py index cdc8abf..3d19861 100644 --- a/setuptools_git_versioning.py +++ b/setuptools_git_versioning.py @@ -152,7 +152,7 @@ def version_from_git(template=DEFAULT_TEMPLATE, else: return version_callback - if not os.path.exists(version_file): + if version_file is None or not os.path.exists(version_file): return starting_version else: from_file = True