Python3 Migrate

This commit is contained in:
MariuszC
2020-01-18 20:01:00 +01:00
parent ea05af2d15
commit 6cd7e0fe44
691 changed files with 201846 additions and 598 deletions

View File

@@ -0,0 +1,29 @@
import os
import subprocess
import mopidy
def get_version():
try:
return get_git_version()
except OSError:
return mopidy.__version__
def get_git_version():
project_dir = os.path.abspath(
os.path.join(os.path.dirname(mopidy.__file__), "..")
)
process = subprocess.Popen(
["git", "describe"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=project_dir,
)
if process.wait() != 0:
raise OSError('Execution of "git describe" failed')
version = process.stdout.read().strip().decode()
if version.startswith("v"):
version = version[1:]
return version