Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed the sanity check for 2016b since the directory structure has … #1096

Merged
merged 6 commits into from Feb 16, 2017
Merged
21 changes: 16 additions & 5 deletions easybuild/easyblocks/m/mcr.py
Expand Up @@ -68,12 +68,16 @@ def configure_step(self):
"""Configure MCR installation: create license file."""

configfile = os.path.join(self.builddir, self.configfilename)
if LooseVersion(self.version) < LooseVersion('2015a'):
if LooseVersion(self.version) < LooseVersion('R2015a'):
shutil.copyfile(os.path.join(self.cfg['start_dir'], 'installer_input.txt'), configfile)
config = read_file(configfile)
config = re.sub(r"^# destinationFolder=.*", "destinationFolder=%s" % self.installdir, config, re.M)
config = re.sub(r"^# agreeToLicense=.*", "agreeToLicense=Yes", config, re.M)
config = re.sub(r"^# mode=.*", "mode=silent", config, re.M)
regdest = re.compile(r"^# destinationFolder=.*", re.M)
regagree = re.compile(r"^# agreeToLicense=.*", re.M)
regmode = re.compile(r"^# mode=.*", re.M)

config = regdest.sub("destinationFolder=%s" % self.installdir, config)
config = regagree.sub("agreeToLicense=Yes", config)
config = regmode.sub("mode=silent", config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bartoldeman why was this changed? compiling a regex first before using it only makes sense if you reuse the compiled regex's multiple times, which is not the case here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because of re.M (=re.MULTILINE)
In python2.7 you can do re.sub(regexp,subst,string,flags=re.M) but this is impossible in python2.6. The 4th argument of re.sub is a count so for that re.M is bogus.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, OK, I wasn't aware of that...

We should include a comment to clarify that, can you add something like this @mboisson?

# compile regex first since re.sub doesn't accept re.M flag for multiline regex in Python 2.6

else:
config = '\n'.join([
"destinationFolder=%s" % self.installdir,
Expand Down Expand Up @@ -121,8 +125,15 @@ def sanity_check_step(self):
"""Custom sanity check for MCR."""
custom_paths = {
'files': [],
'dirs': [os.path.join(self.subdir, x, 'glnxa64') for x in ['runtime', 'bin', 'sys/os']],
'dirs': [os.path.join(self.subdir, 'bin', 'glnxa64')],
}
if LooseVersion(self.version) >= LooseVersion('R2016b'):
custom_paths['dirs'].append(os.path.join(self.subdir, 'cefclient', 'sys', 'os', 'glnxa64'))
else:
custom_paths['dirs'].extend([
os.path.join(self.subdir, 'runtime', 'glnxa64'),
os.path.join(self.subdir, 'sys', 'os', 'glnxa64'),
])
super(EB_MCR, self).sanity_check_step(custom_paths=custom_paths)

def make_module_extra(self):
Expand Down