Skip to content

Commit

Permalink
fix issues with regex patterns for questions raised in interactive in…
Browse files Browse the repository at this point in the history
…stallation command of ABAQUS, by using non-greedy matching (*?) in combination with negative lookahead (?!)
  • Loading branch information
boegel committed Aug 28, 2024
1 parent b7f6ca2 commit 6472d46
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions easybuild/easyblocks/a/abaqus.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,18 @@ def install_step(self):
# Allow for selection or deselection of components from lines of the form:
# 5 [*] Tosca Fluid
# This uses nextstr to make sure we only match the latest output in the Q&A process;
# negative lookahead (?!___) is used to exclude ___...___ lines, to avoid matching across questions
selectionstr = r"\s*(?P<nr>[-0-9]+) %%s %%s[\s\w]*\n((?!%s)(?!___)[\S ]*\n)*%s$" % (nextstr, nextstr)
# negative lookahead (?!___) is used to exclude ___...___ lines, to avoid matching across questions;
# *? to use non-greedy matching in combination with negative lookahead
# (to avoid excessive backtracking by regex engine)
selectionstr = r"\s*(?P<nr>[-0-9]+) %%s %%s.*\n((?!%s)(?!___).*\n)*?%s" % (nextstr, nextstr)

installed_docs = False # hard disabled, previous support was actually incomplete

qa.extend([
# disable Extended Product Documentation because it has a troublesome Java dependency
(selectionstr % (r"\[*\]", "Extended Product Documentation"), '%(nr)s'),
# enable all ABAQUS components
(selectionstr % (r"\[ \]", "Abaqus.*"), '%(nr)s'),
(selectionstr % (r"\[ \]", "Abaqus"), '%(nr)s'),
(selectionstr % (r"\[ \]", "Cosimulation Services"), '%(nr)s'),
# enable 3DSFlow Solver (used to be called "Abaqus/CFD Solver")
(selectionstr % (r"\[ \]", "3DSFlow Solver"), '%(nr)s'),
Expand All @@ -146,9 +148,9 @@ def install_step(self):

# Disable/enable Tosca
if self.cfg['with_tosca']:
qa.append((selectionstr % (r"\[\ \]", "Tosca.*"), '%(nr)s'))
qa.append((selectionstr % (r"\[ \]", "Tosca.*"), '%(nr)s'))
else:
qa.append((selectionstr % (r"\[\\*\]", "Tosca.*"), '%(nr)s'))
qa.append((selectionstr % (r"\[\*\]", "Tosca.*"), '%(nr)s'))

qa.extend([
# disable CloudView
Expand Down Expand Up @@ -182,15 +184,15 @@ def install_step(self):
(r"Default.*SIMULIA/Tosca.*:", os.path.join(self.installdir, 'tosca')),
# paths to STAR-CCM+, FLUENT are requested when Tosca is also installed;
# these do not strictly need to be specified at installation time, so we don't
(r"STAR-CCM.*\n((?!___)[\S ]*\n)*\nDefault \[\]:", ''),
(r"FLUENT.*\n((?!___)[\S ]*\n)*\nDefault \[\]:", ''),
(r"STAR-CCM.*\n((?!___).*\n)*?\nDefault \[\]:", ''),
(r"FLUENT.*\n((?!___).*\n)*?\nDefault \[\]:", ''),
(r"location of your existing ANSA installation.*(\n.*){8}:", ''),
(r"FLUENT Path.*(\n.*){7}:", ''),
(r"working directory to be used by Tosca Fluid\s*(\n.*)*Default \[/usr/temp\]:\s*", '/tmp'),
# License server
(r"License Server [0-9]+\s*(\n.*){3}:", 'abaqusfea'), # bypass value for license server
(r"License Server . \(redundant\)\s*(\n.*){3}:", ''),
(r"License Server Configuration((?!___).*\n)*" + nextstr, ''),
(r"License Server Configuration((?!___).*\n)*?" + nextstr, ''),
(r"Please choose an action:", '1'),
])

Expand Down

0 comments on commit 6472d46

Please sign in to comment.