Adding external recognition to perl (#17756)
* Perl now has external recognition. * Changing code to use the new external packages API.
This commit is contained in:
parent
2f0fd44b97
commit
80a382c218
@ -11,6 +11,7 @@
|
||||
# Author: Justin Too <justin@doubleotoo.com>
|
||||
# Date: September 6, 2015
|
||||
#
|
||||
import re
|
||||
import os
|
||||
from contextlib import contextmanager
|
||||
|
||||
@ -27,6 +28,8 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package
|
||||
# URL must remain http:// so Spack can bootstrap curl
|
||||
url = "http://www.cpan.org/src/5.0/perl-5.24.1.tar.gz"
|
||||
|
||||
executables = [r'^perl(-?\d+.*)?$']
|
||||
|
||||
# see http://www.cpan.org/src/README.html for
|
||||
# explanation of version numbering scheme
|
||||
|
||||
@ -93,6 +96,40 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package
|
||||
|
||||
phases = ['configure', 'build', 'install']
|
||||
|
||||
@classmethod
|
||||
def determine_version(cls, exe):
|
||||
perl = spack.util.executable.Executable(exe)
|
||||
output = perl('--version', output=str)
|
||||
if output:
|
||||
match = re.search(r'perl.*\(v([0-9.]+)\)', output)
|
||||
if match:
|
||||
return match.group(1)
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def determine_variants(cls, exes, version):
|
||||
for exe in exes:
|
||||
perl = spack.util.executable.Executable(exe)
|
||||
output = perl('-V', output=str)
|
||||
variants = ''
|
||||
if output:
|
||||
match = re.search(r'-Duseshrplib', output)
|
||||
if match:
|
||||
variants += '+shared'
|
||||
else:
|
||||
variants += '~shared'
|
||||
match = re.search(r'-Duse.?threads', output)
|
||||
if match:
|
||||
variants += '+threads'
|
||||
else:
|
||||
variants += '~threads'
|
||||
path = os.path.dirname(exe)
|
||||
if 'cpanm' in os.listdir(path):
|
||||
variants += '+cpanm'
|
||||
else:
|
||||
variants += '~cpanm'
|
||||
return variants
|
||||
|
||||
# On a lustre filesystem, patch may fail when files
|
||||
# aren't writeable so make pp.c user writeable
|
||||
# before patching. This should probably walk the
|
||||
|
Loading…
Reference in New Issue
Block a user