Fix Mopidy version when run from another Git repo (related to #706)
This commit is contained in:
parent
f55f3d75c1
commit
292cf8f32d
@ -13,6 +13,12 @@ v0.19.1 (UNRELEASED)
|
||||
Mopidy continue to work on Debian/Raspbian stable, where Tornado 2.3 is the
|
||||
newest version available.
|
||||
|
||||
**Development**
|
||||
|
||||
- ``mopidy --version`` and :meth:`mopidy.core.Core.get_version` now returns the
|
||||
correct version when Mopidy is run from a Git repo other than Mopidy's own.
|
||||
(Related to :issue:`706`)
|
||||
|
||||
|
||||
v0.19.0 (2014-07-21)
|
||||
====================
|
||||
|
||||
@ -1,19 +1,24 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from subprocess import PIPE, Popen
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from mopidy import __version__
|
||||
import mopidy
|
||||
|
||||
|
||||
def get_version():
|
||||
try:
|
||||
return get_git_version()
|
||||
except EnvironmentError:
|
||||
return __version__
|
||||
return mopidy.__version__
|
||||
|
||||
|
||||
def get_git_version():
|
||||
process = Popen(['git', 'describe'], stdout=PIPE, stderr=PIPE)
|
||||
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 EnvironmentError('Execution of "git describe" failed')
|
||||
version = process.stdout.read().strip()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user