mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
validate: Determine development mode using git hash value
Development mode has been determined by whether the launcher is in git repo or not. This could be wrong when the launcher is installed to subdirectory of other project's git repo, such as jhbuild. It is normal to install compiled output to subdirectory of your jhbuild. Changed logic gets the first commit hash of current git repo and compares it with gst-devtools' the first commit hash. https://bugzilla.gnome.org/show_bug.cgi?id=744781
This commit is contained in:
parent
c5393f79f3
commit
2d6c667c9a
1 changed files with 11 additions and 1 deletions
|
@ -18,21 +18,31 @@
|
|||
# Boston, MA 02110-1301, USA.
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
LIBDIR = '@LIBDIR@'
|
||||
GIT_FIRST_HASH = 'da962d096af9460502843e41b7d25fdece7ff1c2'
|
||||
|
||||
|
||||
def _get_git_first_hash(path):
|
||||
try:
|
||||
return subprocess.check_output(['git', '-C', path, 'rev-list', '--max-parents=0', 'HEAD']).rstrip('\n')
|
||||
except subprocess.CalledProcessError:
|
||||
return ''
|
||||
|
||||
|
||||
def _in_devel():
|
||||
root_dir = os.path.abspath(os.path.dirname(os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||
"..", "..", "..")))
|
||||
return os.path.exists(os.path.join(root_dir, '.git'))
|
||||
return _get_git_first_hash(root_dir) == GIT_FIRST_HASH
|
||||
|
||||
|
||||
def _add_gst_launcher_path():
|
||||
if not _in_devel():
|
||||
root = os.path.join(LIBDIR, 'gst-validate-launcher', 'python')
|
||||
else:
|
||||
print "Running with development path"
|
||||
dir_ = os.path.dirname(os.path.abspath(__file__))
|
||||
root = os.path.split(dir_)[0]
|
||||
|
||||
|
|
Loading…
Reference in a new issue