From 6d6f56f07e4b45b8ae66e8b2d430cd198f5425fd Mon Sep 17 00:00:00 2001 From: Simon Branford Date: Sat, 23 Nov 2024 16:35:28 +0000 Subject: [PATCH 1/4] remove use of deprecated parse_log_for_error in rpackage --- easybuild/easyblocks/generic/rpackage.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/easybuild/easyblocks/generic/rpackage.py b/easybuild/easyblocks/generic/rpackage.py index c7aabcc36a..b2b5221ce8 100644 --- a/easybuild/easyblocks/generic/rpackage.py +++ b/easybuild/easyblocks/generic/rpackage.py @@ -43,7 +43,7 @@ from easybuild.tools.build_log import EasyBuildError, print_warning from easybuild.tools.environment import setvar from easybuild.tools.filetools import mkdir, copy_file -from easybuild.tools.run import run_shell_cmd, parse_log_for_error +from easybuild.tools.run import run_shell_cmd def make_R_install_option(opt, values, cmdline=False): @@ -183,8 +183,16 @@ def check_install_output(self, output): """ Check output of installation command, and clean up installation if needed. """ - errors = parse_log_for_error(output, regExp="^ERROR:") + reg = re.compile("^ERROR:", re.I) + + errors = [] + for line in output.split('\n'): + r = reg.search(line) + if r: + errors.append([line, r.groups()]) + if errors: + self.log.info("R package %s failed with error:\n%s", self.name, '\n'.join([x[0] for x in res])) self.handle_installation_errors() cmd = "R -q --no-save" stdin = """ From ddb6c94e3b9eb90b650591aefdcf77f8d71a3bad Mon Sep 17 00:00:00 2001 From: Simon Branford Date: Sat, 23 Nov 2024 16:36:30 +0000 Subject: [PATCH 2/4] oops --- easybuild/easyblocks/generic/rpackage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/easyblocks/generic/rpackage.py b/easybuild/easyblocks/generic/rpackage.py index b2b5221ce8..1fcca38db8 100644 --- a/easybuild/easyblocks/generic/rpackage.py +++ b/easybuild/easyblocks/generic/rpackage.py @@ -192,7 +192,7 @@ def check_install_output(self, output): errors.append([line, r.groups()]) if errors: - self.log.info("R package %s failed with error:\n%s", self.name, '\n'.join([x[0] for x in res])) + self.log.info("R package %s failed with error:\n%s", self.name, '\n'.join([x[0] for x in errors])) self.handle_installation_errors() cmd = "R -q --no-save" stdin = """ From 9bb5841bdf5afa3cfe496ccc2e4b49b3a9e8d947 Mon Sep 17 00:00:00 2001 From: Simon Branford <4967+branfosj@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:10:24 +0000 Subject: [PATCH 3/4] use re.findall --- easybuild/easyblocks/generic/rpackage.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/easybuild/easyblocks/generic/rpackage.py b/easybuild/easyblocks/generic/rpackage.py index 1fcca38db8..bb7e6715eb 100644 --- a/easybuild/easyblocks/generic/rpackage.py +++ b/easybuild/easyblocks/generic/rpackage.py @@ -183,16 +183,10 @@ def check_install_output(self, output): """ Check output of installation command, and clean up installation if needed. """ - reg = re.compile("^ERROR:", re.I) - - errors = [] - for line in output.split('\n'): - r = reg.search(line) - if r: - errors.append([line, r.groups()]) + errors = re.findall(r"^ERROR:.*", output, flags=re.I|re.M) if errors: - self.log.info("R package %s failed with error:\n%s", self.name, '\n'.join([x[0] for x in errors])) + self.log.info("R package %s failed with error:\n%s", self.name, '\n'.join(errors)) self.handle_installation_errors() cmd = "R -q --no-save" stdin = """ From 63719f37a41025031512795595d633a649266ce9 Mon Sep 17 00:00:00 2001 From: Simon Branford <4967+branfosj@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:11:05 +0000 Subject: [PATCH 4/4] hound --- easybuild/easyblocks/generic/rpackage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/easyblocks/generic/rpackage.py b/easybuild/easyblocks/generic/rpackage.py index bb7e6715eb..6ca009de95 100644 --- a/easybuild/easyblocks/generic/rpackage.py +++ b/easybuild/easyblocks/generic/rpackage.py @@ -183,7 +183,7 @@ def check_install_output(self, output): """ Check output of installation command, and clean up installation if needed. """ - errors = re.findall(r"^ERROR:.*", output, flags=re.I|re.M) + errors = re.findall(r"^ERROR:.*", output, flags=re.I | re.M) if errors: self.log.info("R package %s failed with error:\n%s", self.name, '\n'.join(errors))