Remove 'print' calls in version.py

This commit is contained in:
Sylvain Tricot 2023-06-02 11:14:21 +02:00
parent 3811c4baf0
commit d61408e594
1 changed files with 0 additions and 8 deletions

View File

@ -37,23 +37,15 @@ try:
cmd = ["git describe|sed 's/-\([0-9]\+\)-.*/.dev\\1/g'"] cmd = ["git describe|sed 's/-\([0-9]\+\)-.*/.dev\\1/g'"]
result = subprocess.run(cmd, stdout=subprocess.PIPE, shell=True) result = subprocess.run(cmd, stdout=subprocess.PIPE, shell=True)
__version__ = result.stdout.decode('utf-8').strip() __version__ = result.stdout.decode('utf-8').strip()
if __version__ != "":
print("from git: ", __version__)
else:
raise NameError("Not a git repo")
except Exception as err: except Exception as err:
print(err)
try: try:
thisfile_path = os.path.abspath(__file__) thisfile_path = os.path.abspath(__file__)
thisfile_dir = os.path.dirname(thisfile_path) thisfile_dir = os.path.dirname(thisfile_path)
versionfile = os.path.join(thisfile_dir, "./VERSION") versionfile = os.path.join(thisfile_dir, "./VERSION")
with open(versionfile, "r") as fd: with open(versionfile, "r") as fd:
__version__ = fd.readline().strip() __version__ = fd.readline().strip()
print("from VERSION: ", __version__)
except Exception as err: except Exception as err:
try: try:
__version__ = version(PKGNAME) __version__ = version(PKGNAME)
print("from metadata: ", __version__)
except Exception as err: except Exception as err:
print("Unable to get the version number!")
__version__ = "0.0.0" __version__ = "0.0.0"