Commit 1445e953 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

python 3 and 2 compatible

parent d365d13f
#!/usr/bin/env python3 #!/usr/bin/env python3
# Clones and sets up and updates everything, also creates local.conf '''
Copyright 2020, Elphel Inc.
SPDX-License-Identifier: GPL-3.0-or-later
__author__ = "Elphel" Author: Oleg Dzhimiev <oleg@elphel.com>
__copyright__ = "Copyright 2016, Elphel, Inc." Description: Clones and sets up and updates everything, also creates local.conf
__license__ = "GPL" '''
__version__ = "3.0+"
__maintainer__ = "Oleg K Dzhimiev"
__email__ = "oleg@elphel.com"
__status__ = "Development"
import subprocess import subprocess
import os import os
...@@ -58,7 +56,7 @@ def cloneandcheckout(name,item): ...@@ -58,7 +56,7 @@ def cloneandcheckout(name,item):
cwd = os.getcwd() cwd = os.getcwd()
os.chdir(cwd+"/"+name) os.chdir(cwd+"/"+name)
read_remote = subprocess.check_output("git remote -v",shell=True) read_remote = subprocess.check_output("git remote -v",shell=True).decode('utf-8')
if read_remote.find(item[0])==-1: if read_remote.find(item[0])==-1:
print(bcolors.WARNING+"Changing git remote to "+item[0]+bcolors.ENDC) print(bcolors.WARNING+"Changing git remote to "+item[0]+bcolors.ENDC)
shout("git remote set-url origin "+item[0]) shout("git remote set-url origin "+item[0])
...@@ -176,10 +174,10 @@ def update_branch(names_from_conf,name_from_list,pars,git_proto): ...@@ -176,10 +174,10 @@ def update_branch(names_from_conf,name_from_list,pars,git_proto):
#self pull? #self pull?
print(bcolors.BOLDWHITE+"Step 0: Running self git pull"+bcolors.ENDC) print(bcolors.BOLDWHITE+"Step 0: Running self git pull"+bcolors.ENDC)
selfpullresult = subprocess.check_output("git pull",shell=True) selfpullresult = subprocess.check_output("git pull",shell=True).strip().decode('utf-8')
if selfpullresult.strip().decode('utf-8')!="Already up-to-date." and \ if selfpullresult != "Already up-to-date." and \
selfpullresult.strip().decode('utf-8')!="Already up to date.": selfpullresult != "Already up to date.":
print(bcolors.WARNING+"Wasn't up-to-date. Please, rerun ./setup.py"+bcolors.ENDC) print(bcolors.WARNING+"Wasn't up-to-date. Please, rerun ./setup.py"+bcolors.ENDC)
sys.exit() sys.exit()
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment