Parallel fix sbangs (#5910)

* Added procedure to edit sbangs of the parallel perl scripts.

* Specify the types of perl dependency

Adding ", type=('build', 'run')" to the dependency declaration to clarify when and how perl is required

* flake8 cleanup
This commit is contained in:
George Hartzell 2017-10-25 03:15:10 -07:00 committed by Todd Gamblin
parent 3265008ad2
commit 98c06eae92

View File

@ -42,3 +42,19 @@ class Parallel(AutotoolsPackage):
def check(self): def check(self):
# The Makefile has a 'test' target, but it does not work # The Makefile has a 'test' target, but it does not work
make('check') make('check')
depends_on('perl', type=('build', 'run'))
@run_before('install')
def filter_sbang(self):
"""Run before install so that the standard Spack sbang install hook
can fix up the path to the perl binary.
"""
perl = self.spec['perl'].command
kwargs = {'ignore_absent': False, 'backup': False, 'string': False}
with working_dir('src'):
match = '^#!/usr/bin/env perl|^#!/usr/bin/perl.*'
substitute = "#!{perl}".format(perl=perl)
files = ['parallel', 'niceload', 'parcat', 'sql', ]
filter_file(match, substitute, *files, **kwargs)