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

add support to PerlModule easyblock to customize prefix option used in installation command #2979

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions easybuild/easyblocks/generic/perlmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def extra_options():
"""Easyconfig parameters specific to Perl modules."""
extra_vars = {
'runtest': ['test', "Run unit tests.", CUSTOM], # overrides default
'prefix_opt': [None, "String to use for option to set installation prefix (default is 'PREFIX')", CUSTOM],
}
return ExtensionEasyBlock.extra_options(extra_vars)

Expand All @@ -62,14 +63,20 @@ def __init__(self, *args, **kwargs):
def install_perl_module(self):
"""Install procedure for Perl modules: using either Makefile.Pl or Build.PL."""

prefix_opt = self.cfg.get('prefix_opt')

# Perl modules have two possible installation procedures: using Makefile.PL and Build.PL
# configure, build, test, install
if os.path.exists('Makefile.PL'):

if prefix_opt is None:
prefix_opt = 'PREFIX'

install_cmd = ' '.join([
self.cfg['preconfigopts'],
'perl',
'Makefile.PL',
'PREFIX=%s' % self.installdir,
'%s=%s' % (prefix_opt, self.installdir),
self.cfg['configopts'],
])
run_cmd(install_cmd)
Expand All @@ -79,11 +86,15 @@ def install_perl_module(self):
ConfigureMake.install_step(self)

elif os.path.exists('Build.PL'):

if prefix_opt is None:
prefix_opt = '--prefix'

install_cmd = ' '.join([
self.cfg['preconfigopts'],
'perl',
'Build.PL',
'--prefix',
prefix_opt,
self.installdir,
self.cfg['configopts'],
])
Expand Down