summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/llnl/util/lang.py5
-rw-r--r--lib/spack/spack/architecture.py20
-rw-r--r--lib/spack/spack/directives.py10
-rw-r--r--lib/spack/spack/url.py4
-rw-r--r--lib/spack/spack/virtual.py8
-rw-r--r--var/spack/packages/gcc/package.py68
-rw-r--r--var/spack/packages/paraview/package.py72
-rw-r--r--var/spack/packages/xz/package.py8
8 files changed, 136 insertions, 59 deletions
diff --git a/lib/spack/llnl/util/lang.py b/lib/spack/llnl/util/lang.py
index 9e1bef18ca..156ee34c9e 100644
--- a/lib/spack/llnl/util/lang.py
+++ b/lib/spack/llnl/util/lang.py
@@ -87,10 +87,7 @@ def index_by(objects, *funcs):
result = {}
for o in objects:
key = f(o)
- if key not in result:
- result[key] = [o]
- else:
- result[key].append(o)
+ result.setdefault(key, []).append(o)
for key, objects in result.items():
result[key] = index_by(objects, *funcs[1:])
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index 0c4b605e91..05ac5d6f35 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -23,13 +23,12 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
-import platform as py_platform
+import subprocess
from llnl.util.lang import memoized
import spack
import spack.error as serr
-from spack.version import Version
class InvalidSysTypeError(serr.SpackError):
@@ -59,22 +58,23 @@ def get_sys_type_from_environment():
return os.environ.get('SYS_TYPE')
-def get_mac_sys_type():
- """Return a Mac OS SYS_TYPE or None if this isn't a mac."""
- mac_ver = py_platform.mac_ver()[0]
- if not mac_ver:
+def get_sys_type_from_uname():
+ """Return the architecture from uname."""
+ try:
+ arch_proc = subprocess.Popen(['uname', '-i'],
+ stdout=subprocess.PIPE)
+ arch, _ = arch_proc.communicate()
+ return arch.strip()
+ except:
return None
- return "macosx_%s_%s" % (
- Version(mac_ver).up_to(2), py_platform.machine())
-
@memoized
def sys_type():
"""Returns a SysType for the current machine."""
methods = [get_sys_type_from_spack_globals,
get_sys_type_from_environment,
- get_mac_sys_type]
+ get_sys_type_from_uname]
# search for a method that doesn't return None
sys_type = None
diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py
index 9297d6dac3..78039ac6f9 100644
--- a/lib/spack/spack/directives.py
+++ b/lib/spack/spack/directives.py
@@ -239,12 +239,10 @@ def patch(pkg, url_or_filename, level=1, when=None):
when = pkg.name
when_spec = parse_anonymous_spec(when, pkg.name)
- if when_spec not in pkg.patches:
- pkg.patches[when_spec] = [Patch(pkg.name, url_or_filename, level)]
- else:
- # if this spec is identical to some other, then append this
- # patch to the existing list.
- pkg.patches[when_spec].append(Patch(pkg.name, url_or_filename, level))
+ cur_patches = pkg.patches.setdefault(when_spec, [])
+ # if this spec is identical to some other, then append this
+ # patch to the existing list.
+ cur_patches.append(Patch(pkg.name, url_or_filename, level))
@directive('variants')
diff --git a/lib/spack/spack/url.py b/lib/spack/spack/url.py
index 58838306af..6adbfe156d 100644
--- a/lib/spack/spack/url.py
+++ b/lib/spack/spack/url.py
@@ -209,8 +209,8 @@ def parse_version_offset(path):
# e.g. foobar-4.5.1
(r'-((\d+\.)*\d+)$', stem),
- # e.g. foobar-4.5.1b
- (r'-((\d+\.)*\d+\-?([a-z]|rc|RC|tp|TP)\d*)$', stem),
+ # e.g. foobar-4.5.1b, foobar4.5RC, foobar.v4.5.1b
+ (r'[-._]?v?((\d+\.)*\d+[-._]?([a-z]|rc|RC|tp|TP?)\d*)$', stem),
# e.g. foobar-4.5.0-beta1, or foobar-4.50-beta
(r'-((\d+\.)*\d+-beta(\d+)?)$', stem),
diff --git a/lib/spack/spack/virtual.py b/lib/spack/spack/virtual.py
index fa070e6bd5..c77b259d61 100644
--- a/lib/spack/spack/virtual.py
+++ b/lib/spack/spack/virtual.py
@@ -73,10 +73,8 @@ class ProviderIndex(object):
for provided_spec, provider_spec in pkg.provided.iteritems():
if provider_spec.satisfies(spec, deps=False):
provided_name = provided_spec.name
- if provided_name not in self.providers:
- self.providers[provided_name] = {}
- provider_map = self.providers[provided_name]
+ provider_map = self.providers.setdefault(provided_name, {})
if not provided_spec in provider_map:
provider_map[provided_spec] = set()
@@ -133,9 +131,7 @@ class ProviderIndex(object):
if lp_spec.name == rp_spec.name:
try:
const = lp_spec.copy().constrain(rp_spec,deps=False)
- if constrained not in result:
- result[constrained] = set()
- result[constrained].add(const)
+ result.setdefault(constrained, set()).add(const)
except spack.spec.UnsatisfiableSpecError:
continue
return result
diff --git a/var/spack/packages/gcc/package.py b/var/spack/packages/gcc/package.py
index 2fc6794b70..a49a1348aa 100644
--- a/var/spack/packages/gcc/package.py
+++ b/var/spack/packages/gcc/package.py
@@ -36,21 +36,25 @@ class Gcc(Package):
list_url = 'http://open-source-box.org/gcc/'
list_depth = 2
+ DEPENDS_ON_ISL_PREDICATE = '@5.0:'
+
+ version('5.2.0', 'a51bcfeb3da7dd4c623e27207ed43467')
+ version('4.9.3', '6f831b4d251872736e8e9cc09746f327')
version('4.9.2', '4df8ee253b7f3863ad0b86359cd39c43')
version('4.9.1', 'fddf71348546af523353bd43d34919c1')
+ version('4.8.5', '80d2c2982a3392bb0b89673ff136e223')
version('4.8.4', '5a84a30839b2aca22a2d723de2a626ec')
version('4.7.4', '4c696da46297de6ae77a82797d2abe28')
version('4.6.4', 'b407a3d1480c11667f293bfb1f17d1a4')
version('4.5.4', '27e459c2566b8209ab064570e1b378f7')
-
+
depends_on("mpfr")
depends_on("gmp")
depends_on("mpc") # when @4.5:
- depends_on("libelf")
depends_on("binutils~libiberty")
# Save these until we can do optional deps.
- #depends_on("isl")
+ depends_on("isl", when=DEPENDS_ON_ISL_PREDICATE)
#depends_on("ppl")
#depends_on("cloog")
@@ -62,23 +66,31 @@ class Gcc(Package):
if spec.satisfies("@4.7.1:"):
enabled_languages.add('go')
+ # Generic options to compile GCC
+ options = ["--prefix=%s" % prefix,
+ "--libdir=%s/lib64" % prefix,
+ "--disable-multilib",
+ "--enable-languages=" + ','.join(enabled_languages),
+ "--with-mpc=%s" % spec['mpc'].prefix,
+ "--with-mpfr=%s" % spec['mpfr'].prefix,
+ "--with-gmp=%s" % spec['gmp'].prefix,
+ "--enable-lto",
+ "--with-gnu-ld",
+ "--with-gnu-as",
+ "--with-quad"]
+ # Binutils
+ binutils_options = ["--with-stage1-ldflags=%s" % self.rpath_args,
+ "--with-boot-ldflags=%s" % self.rpath_args,
+ "--with-ld=%s/bin/ld" % spec['binutils'].prefix,
+ "--with-as=%s/bin/as" % spec['binutils'].prefix]
+ options.extend(binutils_options)
+ # Isl
+ if spec.satisfies(Gcc.DEPENDS_ON_ISL_PREDICATE):
+ isl_options = ["--with-isl=%s" % spec['isl'].prefix]
+ options.extend(isl_options)
+
# Rest of install is straightforward.
- configure("--prefix=%s" % prefix,
- "--libdir=%s/lib64" % prefix,
- "--disable-multilib",
- "--enable-languages=" + ','.join(enabled_languages),
- "--with-mpc=%s" % spec['mpc'].prefix,
- "--with-mpfr=%s" % spec['mpfr'].prefix,
- "--with-gmp=%s" % spec['gmp'].prefix,
- "--with-libelf=%s" % spec['libelf'].prefix,
- "--with-stage1-ldflags=%s" % self.rpath_args,
- "--with-boot-ldflags=%s" % self.rpath_args,
- "--enable-lto",
- "--with-gnu-ld",
- "--with-ld=%s/bin/ld" % spec['binutils'].prefix,
- "--with-gnu-as",
- "--with-as=%s/bin/as" % spec['binutils'].prefix,
- "--with-quad")
+ configure(*options)
make()
make("install")
@@ -100,13 +112,11 @@ class Gcc(Package):
return
gcc = Executable(join_path(self.prefix.bin, 'gcc'))
- lines = gcc('-dumpspecs', return_output=True).split("\n")
- for i, line in enumerate(lines):
- if line.startswith("*link:"):
- specs_file = join_path(self.spec_dir, 'specs')
- with closing(open(specs_file, 'w')) as out:
- out.write(lines[i] + "\n")
- out.write("-rpath %s/lib:%s/lib64 \\\n"
- % (self.prefix, self.prefix))
- out.write(lines[i+1] + "\n")
- set_install_permissions(specs_file)
+ lines = gcc('-dumpspecs', return_output=True).strip().split("\n")
+ specs_file = join_path(self.spec_dir, 'specs')
+ with closing(open(specs_file, 'w')) as out:
+ for line in lines:
+ out.write(line + "\n")
+ if line.startswith("*link:"):
+ out.write("-rpath %s/lib:%s/lib64 \\\n"% (self.prefix, self.prefix))
+ set_install_permissions(specs_file)
diff --git a/var/spack/packages/paraview/package.py b/var/spack/packages/paraview/package.py
new file mode 100644
index 0000000000..a0ff812ca2
--- /dev/null
+++ b/var/spack/packages/paraview/package.py
@@ -0,0 +1,72 @@
+from spack import *
+
+class Paraview(Package):
+ homepage = 'http://www.paraview.org'
+ url = 'http://www.paraview.org/files/v4.4/ParaView-v4.4.0-source.tar.gz'
+
+ version('4.4.0', 'fa1569857dd680ebb4d7ff89c2227378', url='http://www.paraview.org/files/v4.4/ParaView-v4.4.0-source.tar.gz')
+
+ variant('python', default=False, description='Enable Python support')
+ variant('matplotlib', default=False, description='Enable Matplotlib support')
+ variant('numpy', default=False, description='Enable NumPy support')
+
+ variant('tcl', default=False, description='Enable TCL support')
+
+ variant('mpi', default=False, description='Enable MPI support')
+
+ variant('osmesa', default=False, description='Enable OSMesa support')
+ variant('qt', default=False, description='Enable Qt support')
+
+ depends_on('python', when='+python')
+ depends_on('py-numpy', when='+python+numpy')
+ depends_on('py-matplotlib', when='+python+matplotlib')
+ depends_on('tcl', when='+tcl')
+ depends_on('mpi', when='+mpi')
+ depends_on('qt', when='+qt')
+
+ depends_on('bzip2')
+ depends_on('freetype')
+ depends_on('hdf5') # drags in mpi
+ depends_on('jpeg')
+ depends_on('libpng')
+ depends_on('libtiff')
+ #depends_on('libxml2') # drags in python
+ depends_on('netcdf')
+ #depends_on('protobuf') # version mismatches?
+ #depends_on('sqlite') # external version not supported
+ depends_on('zlib')
+
+ def install(self, spec, prefix):
+ with working_dir('spack-build', create=True):
+ def feature_to_bool(feature, on='ON', off='OFF'):
+ if feature in spec:
+ return on
+ return off
+
+ def nfeature_to_bool(feature):
+ return feature_to_bool(feature, on='OFF', off='ON')
+
+ feature_args = std_cmake_args[:]
+ feature_args.append('-DPARAVIEW_BUILD_QT_GUI:BOOL=%s' % feature_to_bool('+qt'))
+ feature_args.append('-DPARAVIEW_ENABLE_PYTHON:BOOL=%s' % feature_to_bool('+python'))
+ feature_args.append('-DPARAVIEW_USE_MPI:BOOL=%s' % feature_to_bool('+mpi'))
+ feature_args.append('-DVTK_ENABLE_TCL_WRAPPING:BOOL=%s' % feature_to_bool('+tcl'))
+ feature_args.append('-DVTK_OPENGL_HAS_OSMESA:BOOL=%s' % feature_to_bool('+osmesa'))
+ feature_args.append('-DVTK_USE_X:BOOL=%s' % nfeature_to_bool('+osmesa'))
+ feature_args.append('-DVTK_RENDERING_BACKEND:STRING=%s' % feature_to_bool('+opengl2', 'OpenGL2', 'OpenGL'))
+
+ feature_args.extend(std_cmake_args)
+
+ cmake('..',
+ '-DCMAKE_INSTALL_PREFIX:PATH=%s' % prefix,
+ '-DBUILD_TESTING:BOOL=OFF',
+ '-DVTK_USER_SYSTEM_FREETYPE:BOOL=ON',
+ '-DVTK_USER_SYSTEM_HDF5:BOOL=ON',
+ '-DVTK_USER_SYSTEM_JPEG:BOOL=ON',
+ #'-DVTK_USER_SYSTEM_LIBXML2:BOOL=ON',
+ '-DVTK_USER_SYSTEM_NETCDF:BOOL=ON',
+ '-DVTK_USER_SYSTEM_TIFF:BOOL=ON',
+ '-DVTK_USER_SYSTEM_ZLIB:BOOL=ON',
+ *feature_args)
+ make()
+ make('install')
diff --git a/var/spack/packages/xz/package.py b/var/spack/packages/xz/package.py
index 88c5793018..ba6c9733a7 100644
--- a/var/spack/packages/xz/package.py
+++ b/var/spack/packages/xz/package.py
@@ -8,9 +8,13 @@ class Xz(Package):
homepage = "http://tukaani.org/xz/"
url = "http://tukaani.org/xz/xz-5.2.0.tar.bz2"
- version('5.2.0', '867cc8611760240ebf3440bd6e170bb9')
-
+ version('5.2.0', '867cc8611760240ebf3440bd6e170bb9',
+ url = 'http://tukaani.org/xz/xz-5.2.0.tar.bz2')
+ version('5.2.2', 'f90c9a0c8b259aee2234c4e0d7fd70af',
+ url = 'http://tukaani.org/xz/xz-5.2.2.tar.bz2')
+
def install(self, spec, prefix):
configure("--prefix=%s" % prefix)
make()
make("install")
+