// Try to use git first.
try:
version_git = subprocess.check_output(
["git", "describe", "--abbrev=0"]
).decode("utf-8").rstrip()
except (FileNotFoundError, subprocess.CalledProcessError):
// Oops. Just get it from ther version file.
version_git = None
After Change
for line in fh:
if line.startswith("__version__"):
return line.split("=")[-1].strip().replace(""", "")
raise ValueError("Failed to parse version from: {}".format(version_py))
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
setup(