From ac0d5e4edecba227eaa47274e5426a18bab5ee85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 15 Aug 2018 08:28:36 +0200 Subject: [PATCH] createiso: Use correct python version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On some systems we need to use python3, in other places it can be another version. Instead of guessing, let's look at shebang line in lorax executable and use the same. JIRA: COMPOSE-2852 Signed-off-by: Lubomír Sedlář --- pungi/createiso.py | 2 +- pungi/phases/createiso.py | 2 +- tests/test_createiso_phase.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pungi/createiso.py b/pungi/createiso.py index 90da6cf7..d079b778 100644 --- a/pungi/createiso.py +++ b/pungi/createiso.py @@ -35,7 +35,7 @@ def emit(f, cmd): FIND_TEMPLATE_SNIPPET = """ -if ! TEMPLATE="$(python3 -c 'import pylorax; print(pylorax.find_templates())')"; then +if ! TEMPLATE="$($(head -n1 $(which lorax) | cut -c3-) -c 'import pylorax; print(pylorax.find_templates())')"; then TEMPLATE=/usr/share/lorax; fi """.replace('\n', '') diff --git a/pungi/phases/createiso.py b/pungi/phases/createiso.py index aa39152a..328b543b 100644 --- a/pungi/phases/createiso.py +++ b/pungi/phases/createiso.py @@ -258,7 +258,7 @@ def run_createiso_command(runroot, num, compose, bootable, arch, cmd, mounts, packages.append('jigdo') if bootable: extra_packages = { - 'lorax': ['lorax'], + 'lorax': ['lorax', 'which'], 'buildinstall': ['anaconda'], } packages.extend(extra_packages[compose.conf["buildinstall_method"]]) diff --git a/tests/test_createiso_phase.py b/tests/test_createiso_phase.py index 474ee154..c3597820 100644 --- a/tests/test_createiso_phase.py +++ b/tests/test_createiso_phase.py @@ -448,7 +448,7 @@ class CreateisoThreadTest(helpers.PungiTestCase): [mock.call('f25-build', 'x86_64', cmd['cmd'], channel=None, mounts=[self.topdir], packages=['coreutils', 'genisoimage', 'isomd5sum', - 'jigdo', 'lorax'], + 'jigdo', 'lorax', 'which'], task_id=True, use_shell=True, weight=None)]) self.assertEqual( run_runroot.call_args_list,