cue: properly decode() subprocess.check_output()

(breaks on Python 3)
This commit is contained in:
Ralph Lange
2020-06-11 19:33:25 +02:00
parent 3dff483254
commit 769a8ad08d
2 changed files with 6 additions and 5 deletions

View File

@@ -232,7 +232,7 @@ class TestAddDependencyUpToDateCheck(unittest.TestCase):
def is_shallow_repo(place):
check = sp.check_output(['git', 'rev-parse', '--is-shallow-repository'], cwd=place).strip()
check = sp.check_output(['git', 'rev-parse', '--is-shallow-repository'], cwd=place).strip().decode('ascii')
if check == '--is-shallow-repository':
if os.path.exists(os.path.join(place, '.git', 'shallow')):
check = 'true'
@@ -276,7 +276,7 @@ class TestAddDependencyOptions(unittest.TestCase):
cue.setup['MCoreUtils_DEPTH'] = '3'
cue.add_dependency('MCoreUtils')
self.assertTrue(is_shallow_repo(self.location),
'Module not checked out shallow (requested: default=5)')
'Module not checked out shallow (requested: depth=3)')
def test_AddMsiTo314(self):
cue.complete_setup('BASE')

7
cue.py
View File

@@ -514,7 +514,7 @@ def detect_epics_host_arch():
]
for eha in eha_scripts:
if os.path.exists(eha):
os.environ['EPICS_HOST_ARCH'] = sp.check_output(['perl', eha]).strip()
os.environ['EPICS_HOST_ARCH'] = sp.check_output(['perl', eha]).decode('ascii').strip()
logger.debug('%s returned: %s',
eha, os.environ['EPICS_HOST_ARCH'])
break
@@ -594,7 +594,7 @@ def setup_for_build(args):
has_test_results = True
# Check make version
if re.match(r'^GNU Make 3', sp.check_output(['make', '-v'])):
if re.match(r'^GNU Make 3', sp.check_output(['make', '-v']).decode('ascii')):
is_make3 = True
# apparently %CD% is handled automagically
@@ -847,7 +847,8 @@ USR_CXXFLAGS += {0}'''.format(os.environ['USR_CXXFLAGS'])
stat = 'rebuilt'
else:
stat = 'from cache'
commit = sp.check_output(['git', 'log', '-n1', '--oneline'], cwd=places[setup[mod + "_VARNAME"]]).strip()
commit = sp.check_output(['git', 'log', '-n1', '--oneline'], cwd=places[setup[mod + "_VARNAME"]])\
.decode('ascii').strip()
print("%-10s %-12s %-11s %s" % (mod, setup[mod], stat, commit))
print('{0}Contents of RELEASE.local{1}'.format(ANSI_CYAN, ANSI_RESET))