diff options
author | Milton Woods <miltonjwoods@gmail.com> | 2017-07-24 00:41:45 +1000 |
---|---|---|
committer | Adam J. Stewart <ajstewart426@gmail.com> | 2017-07-23 09:41:45 -0500 |
commit | 4044e9f91819ad2c7859781eb807fa16e0e0c7f3 (patch) | |
tree | fce701bcbe7009f2bd377d5b4decda81f998a8f3 /var | |
parent | 62b4087c09ea22e98d364f5cacc92c53794ac322 (diff) | |
download | spack-4044e9f91819ad2c7859781eb807fa16e0e0c7f3.tar.gz spack-4044e9f91819ad2c7859781eb807fa16e0e0c7f3.tar.bz2 spack-4044e9f91819ad2c7859781eb807fa16e0e0c7f3.tar.xz spack-4044e9f91819ad2c7859781eb807fa16e0e0c7f3.zip |
Perl - allow package activation without PERL5LIB variable (#4540)
* perl: prepend default perl @INC path to support package activation
* perl: remove stray comma from list of configure arguments
* perl: final comma in configure arguments makes adding arguments safer
This reverts commit fdc10cd611f525ebc31ca1953e048095b1c75350.
* perl: add comment about modified @INC (thanks to George Hartzell)
* perl: use self.prefix.lib and self.prefix.bin for clarity
* perl: convert tabs added by editor to spaces for flake8
* perl: use new path syntax: prefix.lib.perl5
* perl: avoid line break before binary operator
* perl: use compact spack syntax for perl executable
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/perl/package.py | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/var/spack/repos/builtin/packages/perl/package.py b/var/spack/repos/builtin/packages/perl/package.py index d9952cc936..1e5e93a2f4 100644 --- a/var/spack/repos/builtin/packages/perl/package.py +++ b/var/spack/repos/builtin/packages/perl/package.py @@ -93,6 +93,23 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package '-Dloclibpth=' + self.spec['gdbm'].prefix.lib, ] + # Extensions are installed into their private tree via + # `INSTALL_BASE`/`--install_base` (see [1]) which results in a + # "predictable" installation tree that sadly does not match the + # Perl core's @INC structure. This means that when activation + # merges the extension into the extendee[2], the directory tree + # containing the extensions is not on @INC and the extensions can + # not be found. + # + # This bit prepends @INC with the directory that is used when + # extensions are activated [3]. + # + # [1] https://metacpan.org/pod/ExtUtils::MakeMaker#INSTALL_BASE + # [2] via the activate method in the PackageBase class + # [3] https://metacpan.org/pod/distribution/perl/INSTALL#APPLLIB_EXP + config_args.append('-Accflags=-DAPPLLIB_EXP=\\"' + + self.prefix.lib.perl5 + '\\"') + # Discussion of -fPIC for Intel at: # https://github.com/LLNL/spack/pull/3081 and # https://github.com/LLNL/spack/pull/4416 @@ -130,10 +147,6 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package make() make('install') - def setup_environment(self, spack_env, run_env): - """Set PERL5LIB to support activation of Perl packages""" - run_env.set('PERL5LIB', join_path(self.prefix, 'lib', 'perl5')) - def setup_dependent_environment(self, spack_env, run_env, dependent_spec): """Set PATH and PERL5LIB to include the extension and any other perl extensions it depends on, @@ -143,8 +156,8 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package for d in dependent_spec.traverse( deptype=('build', 'run'), deptype_query='run'): if d.package.extends(self.spec): - perl_lib_dirs.append(join_path(d.prefix, 'lib', 'perl5')) - perl_bin_dirs.append(join_path(d.prefix, 'bin')) + perl_lib_dirs.append(d.prefix.lib.perl5) + perl_bin_dirs.append(d.prefix.bin) perl_bin_path = ':'.join(perl_bin_dirs) perl_lib_path = ':'.join(perl_lib_dirs) spack_env.prepend_path('PATH', perl_bin_path) @@ -159,10 +172,10 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package """ # perl extension builds can have a global perl executable function - module.perl = Executable(join_path(self.spec.prefix.bin, 'perl')) + module.perl = self.spec['perl'].command # Add variables for library directory - module.perl_lib_dir = join_path(dependent_spec.prefix, 'lib', 'perl5') + module.perl_lib_dir = dependent_spec.prefix.lib.perl5 # Make the site packages directory for extensions, # if it does not exist already. @@ -179,7 +192,7 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package kwargs = {'ignore_absent': True, 'backup': False, 'string': False} # Find the actual path to the installed Config.pm file. - perl = Executable(join_path(prefix.bin, 'perl')) + perl = self.spec['perl'].command config_dot_pm = perl('-MModule::Loaded', '-MConfig', '-e', 'print is_loaded(Config)', output=str) |