def upgrade_sdk(path): venv_bin = os.path.join(path, 'venv', 'bin') os.environ['PATH'] = ':'.join(x for x in os.environ['PATH'].split(':') if x != venv_bin) with chdir(path): check_call(['git', 'pull', REPO_URL, RELEASE_BRANCH]) args = ['python', os.path.join(path, 'install.py')] os.execvp('python', args)
def get_remote_revision(path): with chdir(path): check_call(['git', 'fetch', REPO_URL, RELEASE_BRANCH], stderr=open('/dev/null', 'w')) return Popen(['git', 'rev-parse', 'FETCH_HEAD'], stdout=PIPE).communicate()[0].strip()
def get_local_revision(path): with chdir(path): return Popen(['git', 'rev-parse', 'HEAD'], stdout=PIPE).communicate()[0].strip()