summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorRobert Blake <blake14@llnl.gov>2020-08-11 17:06:20 -0700
committerGitHub <noreply@github.com>2020-08-11 17:06:20 -0700
commit80a382c2182800b735571ebf53c37715b4155608 (patch)
treee66835fa6ec139d678dbc44a6c6983ce9851e0ac /var
parent2f0fd44b97d00834f152e1a60168310ed5e646f7 (diff)
downloadspack-80a382c2182800b735571ebf53c37715b4155608.tar.gz
spack-80a382c2182800b735571ebf53c37715b4155608.tar.bz2
spack-80a382c2182800b735571ebf53c37715b4155608.tar.xz
spack-80a382c2182800b735571ebf53c37715b4155608.zip
Adding external recognition to perl (#17756)
* Perl now has external recognition. * Changing code to use the new external packages API.
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/perl/package.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/perl/package.py b/var/spack/repos/builtin/packages/perl/package.py
index 5333a92f3c..a68b97eac6 100644
--- a/var/spack/repos/builtin/packages/perl/package.py
+++ b/var/spack/repos/builtin/packages/perl/package.py
@@ -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