summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2016-01-02 22:48:14 +0100
committeralalazo <massimiliano.culpo@googlemail.com>2016-01-02 22:48:14 +0100
commitbf4231dd4b906f20d522b9df5f2cae2ba6291174 (patch)
treed745c6d061f5c86caf81af2e0ec3100226095183
parent3c64c18bfc3ff561bce425ef9e40ba1c131f0c97 (diff)
downloadspack-bf4231dd4b906f20d522b9df5f2cae2ba6291174.tar.gz
spack-bf4231dd4b906f20d522b9df5f2cae2ba6291174.tar.bz2
spack-bf4231dd4b906f20d522b9df5f2cae2ba6291174.tar.xz
spack-bf4231dd4b906f20d522b9df5f2cae2ba6291174.zip
depends_on and when multimethod support boolean
-rw-r--r--lib/spack/spack/directives.py6
-rw-r--r--lib/spack/spack/multimethod.py9
-rw-r--r--lib/spack/spack/util/architecture.py46
-rw-r--r--var/spack/packages/openssl/package.py15
4 files changed, 72 insertions, 4 deletions
diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py
index aa9fbd8d33..02477bb904 100644
--- a/lib/spack/spack/directives.py
+++ b/lib/spack/spack/directives.py
@@ -174,7 +174,11 @@ def version(pkg, ver, checksum=None, **kwargs):
def _depends_on(pkg, spec, when=None):
- if when is None:
+ # If when is False do nothing
+ if when is False:
+ return
+ # If when is None or True make sure the condition is always satisfied
+ if when is None or when is True:
when = pkg.name
when_spec = parse_anonymous_spec(when, pkg.name)
diff --git a/lib/spack/spack/multimethod.py b/lib/spack/spack/multimethod.py
index df9b9b2ab1..51c6a8e89d 100644
--- a/lib/spack/spack/multimethod.py
+++ b/lib/spack/spack/multimethod.py
@@ -193,10 +193,11 @@ class when(object):
platform-specific versions. There's not much we can do to get
around this because of the way decorators work.
"""
-class when(object):
def __init__(self, spec):
pkg = get_calling_module_name()
- self.spec = parse_anonymous_spec(spec, pkg)
+ if spec is True:
+ spec = pkg
+ self.spec = parse_anonymous_spec(spec, pkg) if spec is not False else None
def __call__(self, method):
# Get the first definition of the method in the calling scope
@@ -207,7 +208,9 @@ class when(object):
if not type(original_method) == SpecMultiMethod:
original_method = SpecMultiMethod(original_method)
- original_method.register(self.spec, method)
+ if self.spec is not None:
+ original_method.register(self.spec, method)
+
return original_method
diff --git a/lib/spack/spack/util/architecture.py b/lib/spack/spack/util/architecture.py
new file mode 100644
index 0000000000..a020c74a7a
--- /dev/null
+++ b/lib/spack/spack/util/architecture.py
@@ -0,0 +1,46 @@
+##############################################################################
+# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
+# LLNL-CODE-647188
+#
+# For details, see https://github.com/llnl/spack
+# Please also see the LICENSE file for our notice and the LGPL.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License (as published by
+# the Free Software Foundation) version 2.1 dated February 1999.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
+# conditions of the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##############################################################################
+
+import sys
+
+
+def os_is_in(*args):
+ """
+ Return True if any element in the list is equal to sys.platform, False otherwise
+
+ :param args: list of names to be checked
+ :return: True or False
+ """
+ return any(map(lambda x: x == sys.platform, args))
+
+
+def os_is_not_in(*args):
+ """
+ Return True if none of the elements in the list is equal to sys.platform, False otherwise
+
+ :param args: list of names to be checked
+ :return: True or False
+ """
+ return not os_is_in(*args)
diff --git a/var/spack/packages/openssl/package.py b/var/spack/packages/openssl/package.py
index 40648fca49..1fa288a36d 100644
--- a/var/spack/packages/openssl/package.py
+++ b/var/spack/packages/openssl/package.py
@@ -1,5 +1,7 @@
from spack import *
+import spack.util.architecture as arch
+
class Openssl(Package):
"""The OpenSSL Project is a collaborative effort to develop a
robust, commercial-grade, full-featured, and Open Source
@@ -26,3 +28,16 @@ class Openssl(Package):
make()
make("install")
+
+ @when(arch.os_is_in('darwin'))
+ def install(self, spec, prefix):
+ perl = which('perl')
+ perl("./Configure",
+ "--prefix=%s" % prefix,
+ "--openssldir=%s/etc/openssl" % prefix,
+ "zlib",
+ "no-krb5",
+ "shared",
+ "darwin64-x86_64-cc")
+ filter_file(r'-arch x86_64', '', 'Makefile')
+