From 769a8ad08d6c9b6053f555b5e2d7670cbfb5d6d5 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Thu, 11 Jun 2020 19:33:25 +0200 Subject: [PATCH] cue: properly decode() subprocess.check_output() (breaks on Python 3) --- cue-test.py | 4 ++-- cue.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cue-test.py b/cue-test.py index 0561f25..4286a7d 100644 --- a/cue-test.py +++ b/cue-test.py @@ -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') diff --git a/cue.py b/cue.py index 3d8874d..d642754 100644 --- a/cue.py +++ b/cue.py @@ -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))