From ea31440918e1493be54fea6318112f431662997d Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 19 Dec 2024 17:33:53 +0100 Subject: [PATCH 1/2] inject custom '%(python)s' template value before getting value of 'buildcmd' custom easyconfig parameter in PythonPackage easyblock --- easybuild/easyblocks/generic/pythonpackage.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/easybuild/easyblocks/generic/pythonpackage.py b/easybuild/easyblocks/generic/pythonpackage.py index 855a0c533e..875158df6d 100644 --- a/easybuild/easyblocks/generic/pythonpackage.py +++ b/easybuild/easyblocks/generic/pythonpackage.py @@ -818,7 +818,11 @@ def configure_step(self): def build_step(self): """Build Python package using setup.py""" - build_cmd = self.cfg.get_ref('buildcmd') + + # inject extra '%(python)s' template value before getting value of 'buildcmd' custom easyconfig parameter + self.cfg.template_values['python'] = self.python_cmd + build_cmd = self.cfg['buildcmd'] + if self.use_setup_py: if get_software_root('CMake'): @@ -829,10 +833,9 @@ def build_step(self): if not build_cmd: build_cmd = 'build' # Default value for setup.py - build_cmd = '%(python)s setup.py ' + build_cmd + build_cmd = self.python_cmd + ' setup.py ' + build_cmd if build_cmd: - build_cmd = build_cmd % {'python': self.python_cmd} cmd = ' '.join([self.cfg['prebuildopts'], build_cmd, self.cfg['buildopts']]) res = run_shell_cmd(cmd) From 51ce29903ddeab2c50d3b94449e390450578d957 Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Thu, 19 Dec 2024 19:45:45 +0100 Subject: [PATCH 2/2] replace concatenation with f-string in PythonPackage easyblock --- easybuild/easyblocks/generic/pythonpackage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/easyblocks/generic/pythonpackage.py b/easybuild/easyblocks/generic/pythonpackage.py index 875158df6d..e9ea708309 100644 --- a/easybuild/easyblocks/generic/pythonpackage.py +++ b/easybuild/easyblocks/generic/pythonpackage.py @@ -833,7 +833,7 @@ def build_step(self): if not build_cmd: build_cmd = 'build' # Default value for setup.py - build_cmd = self.python_cmd + ' setup.py ' + build_cmd + build_cmd = f"{self.python_cmd} setup.py {build_cmd}" if build_cmd: cmd = ' '.join([self.cfg['prebuildopts'], build_cmd, self.cfg['buildopts']])