summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2016-07-19 09:05:27 +0200
committeralalazo <massimiliano.culpo@googlemail.com>2016-07-19 09:05:27 +0200
commitacfeb5d04379ddfdb724688600a4bd825617a603 (patch)
tree232fba7a4996e0d651c3f13ae8a4258bd034571d /lib
parenta96eb7096de0c39d9157019525b024760d2bc80b (diff)
parent7555c3d9492b14d30866b7c5ec0ead79347ead05 (diff)
downloadspack-acfeb5d04379ddfdb724688600a4bd825617a603.tar.gz
spack-acfeb5d04379ddfdb724688600a4bd825617a603.tar.bz2
spack-acfeb5d04379ddfdb724688600a4bd825617a603.tar.xz
spack-acfeb5d04379ddfdb724688600a4bd825617a603.zip
Merge branch 'develop' of https://github.com/LLNL/spack into features/module_refresh
Conflicts: lib/spack/spack/test/__init__.py
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/bootstrap.py49
-rw-r--r--lib/spack/spack/cmd/checksum.py21
-rw-r--r--lib/spack/spack/cmd/create.py145
-rw-r--r--lib/spack/spack/cmd/package-list.py24
-rw-r--r--lib/spack/spack/platforms/cray_xc.py9
-rw-r--r--lib/spack/spack/preferred_packages.py105
-rw-r--r--lib/spack/spack/test/__init__.py22
-rw-r--r--lib/spack/spack/test/build_system_guess.py (renamed from lib/spack/spack/test/configure_guess.py)26
-rw-r--r--lib/spack/spack/test/modules.py3
9 files changed, 229 insertions, 175 deletions
diff --git a/lib/spack/spack/cmd/bootstrap.py b/lib/spack/spack/cmd/bootstrap.py
index bec11439b5..60e2bd3a11 100644
--- a/lib/spack/spack/cmd/bootstrap.py
+++ b/lib/spack/spack/cmd/bootstrap.py
@@ -23,7 +23,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
-from subprocess import check_call
import llnl.util.tty as tty
from llnl.util.filesystem import join_path, mkdirp
@@ -31,26 +30,49 @@ from llnl.util.filesystem import join_path, mkdirp
import spack
from spack.util.executable import which
+_SPACK_UPSTREAM = 'https://github.com/llnl/spack'
+
description = "Create a new installation of spack in another prefix"
+
def setup_parser(subparser):
- subparser.add_argument('prefix', help="names of prefix where we should install spack")
+ subparser.add_argument(
+ '-r', '--remote', action='store', dest='remote',
+ help="name of the remote to bootstrap from", default='origin')
+ subparser.add_argument(
+ 'prefix',
+ help="names of prefix where we should install spack")
-def get_origin_url():
+def get_origin_info(remote):
git_dir = join_path(spack.prefix, '.git')
git = which('git', required=True)
- origin_url = git(
- '--git-dir=%s' % git_dir, 'config', '--get', 'remote.origin.url',
- output=str)
- return origin_url.strip()
+ try:
+ branch = git('symbolic-ref', '--short', 'HEAD', output=str)
+ except ProcessError:
+ branch = 'develop'
+ tty.warn('No branch found; using default branch: %s' % branch)
+ if remote == 'origin' and \
+ branch not in ('master', 'develop'):
+ branch = 'develop'
+ tty.warn('Unknown branch found; using default branch: %s' % branch)
+ try:
+ origin_url = git(
+ '--git-dir=%s' % git_dir,
+ 'config', '--get', 'remote.%s.url' % remote,
+ output=str)
+ except ProcessError:
+ origin_url = _SPACK_UPSTREAM
+ tty.warn('No git repository found; '
+ 'using default upstream URL: %s' % origin_url)
+ return (origin_url.strip(), branch.strip())
def bootstrap(parser, args):
- origin_url = get_origin_url()
+ origin_url, branch = get_origin_info(args.remote)
prefix = args.prefix
- tty.msg("Fetching spack from origin: %s" % origin_url)
+ tty.msg("Fetching spack from '%s': %s" % (args.remote, origin_url))
if os.path.isfile(prefix):
tty.die("There is already a file at %s" % prefix)
@@ -62,7 +84,8 @@ def bootstrap(parser, args):
files_in_the_way = os.listdir(prefix)
if files_in_the_way:
- tty.die("There are already files there! Delete these files before boostrapping spack.",
+ tty.die("There are already files there! "
+ "Delete these files before boostrapping spack.",
*files_in_the_way)
tty.msg("Installing:",
@@ -73,8 +96,10 @@ def bootstrap(parser, args):
git = which('git', required=True)
git('init', '--shared', '-q')
git('remote', 'add', 'origin', origin_url)
- git('fetch', 'origin', 'master:refs/remotes/origin/master', '-n', '-q')
- git('reset', '--hard', 'origin/master', '-q')
+ git('fetch', 'origin', '%s:refs/remotes/origin/%s' % (branch, branch),
+ '-n', '-q')
+ git('reset', '--hard', 'origin/%s' % branch, '-q')
+ git('checkout', '-B', branch, 'origin/%s' % branch, '-q')
tty.msg("Successfully created a new spack in %s" % prefix,
"Run %s/bin/spack to use this installation." % prefix)
diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py
index 95bd4771ed..aedb0fd99c 100644
--- a/lib/spack/spack/cmd/checksum.py
+++ b/lib/spack/spack/cmd/checksum.py
@@ -42,7 +42,8 @@ def setup_parser(subparser):
'--keep-stage', action='store_true', dest='keep_stage',
help="Don't clean up staging area when command completes.")
subparser.add_argument(
- 'versions', nargs=argparse.REMAINDER, help='Versions to generate checksums for')
+ 'versions', nargs=argparse.REMAINDER,
+ help='Versions to generate checksums for')
def get_checksums(versions, urls, **kwargs):
@@ -59,10 +60,10 @@ def get_checksums(versions, urls, **kwargs):
with Stage(url, keep=keep_stage) as stage:
stage.fetch()
if i == 0 and first_stage_function:
- first_stage_function(stage)
+ first_stage_function(stage, url)
- hashes.append((version,
- spack.util.crypto.checksum(hashlib.md5, stage.archive_file)))
+ hashes.append((version, spack.util.crypto.checksum(
+ hashlib.md5, stage.archive_file)))
i += 1
except FailedDownloadError as e:
tty.msg("Failed to fetch %s" % url)
@@ -79,12 +80,12 @@ def checksum(parser, args):
# If the user asked for specific versions, use those.
if args.versions:
versions = {}
- for v in args.versions:
- v = ver(v)
- if not isinstance(v, Version):
+ for version in args.versions:
+ version = ver(version)
+ if not isinstance(version, Version):
tty.die("Cannot generate checksums for version lists or " +
"version ranges. Use unambiguous versions.")
- versions[v] = pkg.url_for_version(v)
+ versions[version] = pkg.url_for_version(version)
else:
versions = pkg.fetch_remote_versions()
if not versions:
@@ -111,5 +112,7 @@ def checksum(parser, args):
if not version_hashes:
tty.die("Could not fetch any versions for %s" % pkg.name)
- version_lines = [" version('%s', '%s')" % (v, h) for v, h in version_hashes]
+ version_lines = [
+ " version('%s', '%s')" % (v, h) for v, h in version_hashes
+ ]
tty.msg("Checksummed new versions of %s:" % pkg.name, *version_lines)
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index c9fa687b74..2c440096d1 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -103,6 +103,64 @@ ${versions}
${install}
""")
+# Build dependencies and extensions
+dependencies_dict = {
+ 'autotools': "# depends_on('foo')",
+ 'cmake': "depends_on('cmake')",
+ 'scons': "depends_on('scons')",
+ 'python': "extends('python')",
+ 'R': "extends('R')",
+ 'octave': "extends('octave')",
+ 'unknown': "# depends_on('foo')"
+}
+
+# Default installation instructions
+install_dict = {
+ 'autotools': """\
+ # FIXME: Modify the configure line to suit your build system here.
+ configure('--prefix={0}'.format(prefix))
+
+ # FIXME: Add logic to build and install here.
+ make()
+ make('install')""",
+
+ 'cmake': """\
+ with working_dir('spack-build', create=True):
+ # FIXME: Modify the cmake line to suit your build system here.
+ cmake('..', *std_cmake_args)
+
+ # FIXME: Add logic to build and install here.
+ make()
+ make('install')""",
+
+ 'scons': """\
+ # FIXME: Add logic to build and install here.
+ scons('prefix={0}'.format(prefix))
+ scons('install')""",
+
+ 'python': """\
+ # FIXME: Add logic to build and install here.
+ python('setup.py', 'install', '--prefix={0}'.format(prefix))""",
+
+ 'R': """\
+ # FIXME: Add logic to build and install here.
+ R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+ self.stage.source_path)""",
+
+ 'octave': """\
+ # FIXME: Add logic to build and install here.
+ octave('--quiet', '--norc',
+ '--built-in-docstrings-file=/dev/null',
+ '--texi-macros-file=/dev/null',
+ '--eval', 'pkg prefix {0}; pkg install {1}'.format(
+ prefix, self.stage.archive_file))""",
+
+ 'unknown': """\
+ # FIXME: Unknown build system
+ make()
+ make('install')"""
+}
+
def make_version_calls(ver_hash_tuples):
"""Adds a version() call to the package for each version found."""
@@ -133,60 +191,17 @@ def setup_parser(subparser):
setup_parser.subparser = subparser
-class ConfigureGuesser(object):
- def __call__(self, stage):
- """Try to guess the type of build system used by the project.
- Set any necessary build dependencies or extensions.
- Set the appropriate default installation instructions."""
-
- # Build dependencies and extensions
- dependenciesDict = {
- 'autotools': "# depends_on('foo')",
- 'cmake': "depends_on('cmake', type='build')",
- 'scons': "depends_on('scons', type='build')",
- 'python': "extends('python', type=nolink)",
- 'R': "extends('R')",
- 'unknown': "# depends_on('foo')"
- }
-
- # Default installation instructions
- installDict = {
- 'autotools': """\
- # FIXME: Modify the configure line to suit your build system here.
- configure('--prefix={0}'.format(prefix))
-
- # FIXME: Add logic to build and install here.
- make()
- make('install')""",
-
- 'cmake': """\
- with working_dir('spack-build', create=True):
- # FIXME: Modify the cmake line to suit your build system here.
- cmake('..', *std_cmake_args)
+class BuildSystemGuesser(object):
+ def __call__(self, stage, url):
+ """Try to guess the type of build system used by a project based on
+ the contents of its archive or the URL it was downloaded from."""
- # FIXME: Add logic to build and install here.
- make()
- make('install')""",
-
- 'scons': """\
- # FIXME: Add logic to build and install here.
- scons('prefix={0}'.format(prefix))
- scons('install')""",
-
- 'python': """\
- # FIXME: Add logic to build and install here.
- python('setup.py', 'install', '--prefix={0}'.format(prefix))""",
-
- 'R': """\
- # FIXME: Add logic to build and install here.
- R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
- self.stage.source_path)""",
-
- 'unknown': """\
- # FIXME: Unknown build system
- make()
- make('install')"""
- }
+ # Most octave extensions are hosted on Octave-Forge:
+ # http://octave.sourceforge.net/index.html
+ # They all have the same base URL.
+ if 'downloads.sourceforge.net/octave/' in url:
+ self.build_system = 'octave'
+ return
# A list of clues that give us an idea of the build system a package
# uses. If the regular expression matches a file contained in the
@@ -224,12 +239,6 @@ class ConfigureGuesser(object):
self.build_system = build_system
- # Set any necessary build dependencies or extensions.
- self.dependencies = dependenciesDict[build_system]
-
- # Set the appropriate default installation instructions
- self.install = installDict[build_system]
-
def guess_name_and_version(url, args):
# Try to deduce name and version of the new package from the URL
@@ -334,8 +343,8 @@ def create(parser, args):
# Fetch tarballs (prompting user if necessary)
versions, urls = fetch_tarballs(url, name, version)
- # Try to guess what configure system is used.
- guesser = ConfigureGuesser()
+ # Try to guess what build system is used.
+ guesser = BuildSystemGuesser()
ver_hash_tuples = spack.cmd.checksum.get_checksums(
versions, urls,
first_stage_function=guesser,
@@ -344,13 +353,13 @@ def create(parser, args):
if not ver_hash_tuples:
tty.die("Could not fetch any tarballs for %s" % name)
- # Prepend 'py-' to python package names, by convention.
+ # Add prefix to package name if it is an extension.
if guesser.build_system == 'python':
- name = 'py-%s' % name
-
- # Prepend 'r-' to R package names, by convention.
+ name = 'py-{0}'.format(name)
if guesser.build_system == 'R':
- name = 'r-%s' % name
+ name = 'r-{0}'.format(name)
+ if guesser.build_system == 'octave':
+ name = 'octave-{0}'.format(name)
# Create a directory for the new package.
pkg_path = repo.filename_for_package_name(name)
@@ -367,8 +376,8 @@ def create(parser, args):
class_name=mod_to_class(name),
url=url,
versions=make_version_calls(ver_hash_tuples),
- dependencies=guesser.dependencies,
- install=guesser.install))
+ dependencies=dependencies_dict[guesser.build_system],
+ install=install_dict[guesser.build_system]))
# If everything checks out, go ahead and edit.
spack.editor(pkg_path)
diff --git a/lib/spack/spack/cmd/package-list.py b/lib/spack/spack/cmd/package-list.py
index bc64c77eab..a27502d30e 100644
--- a/lib/spack/spack/cmd/package-list.py
+++ b/lib/spack/spack/cmd/package-list.py
@@ -22,10 +22,8 @@
# 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 re
import cgi
from StringIO import StringIO
-import llnl.util.tty as tty
from llnl.util.tty.colify import *
import spack
@@ -34,21 +32,22 @@ description = "Print a list of all packages in reStructuredText."
def github_url(pkg):
"""Link to a package file on github."""
- return ("https://github.com/llnl/spack/blob/master/var/spack/packages/%s/package.py" %
- pkg.name)
+ url = "https://github.com/llnl/spack/blob/master/var/spack/packages/%s/package.py" # NOQA: ignore=E501
+ return (url % pkg.name)
def rst_table(elts):
"""Print out a RST-style table."""
cols = StringIO()
ncol, widths = colify(elts, output=cols, tty=True)
- header = " ".join("=" * (w-1) for w in widths)
+ header = " ".join("=" * (w - 1) for w in widths)
return "%s\n%s%s" % (header, cols.getvalue(), header)
def print_rst_package_list():
"""Print out information on all packages in restructured text."""
- pkgs = sorted(spack.repo.all_packages(), key=lambda s:s.name.lower())
+ pkgs = sorted(spack.repo.all_packages(), key=lambda s: s.name.lower())
+ pkg_names = [p.name for p in pkgs]
print ".. _package-list:"
print
@@ -62,7 +61,7 @@ def print_rst_package_list():
print "Spack currently has %d mainline packages:" % len(pkgs)
print
- print rst_table("`%s`_" % p.name for p in pkgs)
+ print rst_table("`%s`_" % p for p in pkg_names)
print
print "-----"
@@ -79,14 +78,15 @@ def print_rst_package_list():
print
if pkg.versions:
print "Versions:"
- print " " + ", ".join(str(v) for v in reversed(sorted(pkg.versions)))
+ print " " + ", ".join(str(v) for v in
+ reversed(sorted(pkg.versions)))
- for deptype in ('build', 'link', 'run'):
- deps = pkg.dependencies(deptype)
+ for deptype in spack.alldeps:
+ deps = pkg.dependencies_of_type(deptype)
if deps:
print "%s Dependencies" % deptype.capitalize()
- print " " + ", ".join("`%s`_" % d if d != "mpi" else d
- for d in build_deps)
+ print " " + ", ".join("%s_" % d if d in pkg_names
+ else d for d in deps)
print
print "Description:"
diff --git a/lib/spack/spack/platforms/cray_xc.py b/lib/spack/spack/platforms/cray_xc.py
index e710303e23..8dc575bb71 100644
--- a/lib/spack/spack/platforms/cray_xc.py
+++ b/lib/spack/spack/platforms/cray_xc.py
@@ -2,6 +2,7 @@ import os
from spack.architecture import Platform, Target
from spack.operating_systems.linux_distro import LinuxDistro
from spack.operating_systems.cnl import Cnl
+from spack.util.executable import which
class CrayXc(Platform):
priority = 20
@@ -42,5 +43,11 @@ class CrayXc(Platform):
@classmethod
def detect(self):
- return os.path.exists('/opt/cray/craype')
+ if os.path.exists('/cray_home'):
+ cc_verbose = which('cc')
+ cc_verbose.add_default_arg('-craype-verbose')
+ text = cc_verbose(output=str, error=str, ignore_errors=True).split()
+ if '-D__CRAYXC' in text:
+ return True
+ return False
diff --git a/lib/spack/spack/preferred_packages.py b/lib/spack/spack/preferred_packages.py
index 4820584150..1b94f03de7 100644
--- a/lib/spack/spack/preferred_packages.py
+++ b/lib/spack/spack/preferred_packages.py
@@ -26,8 +26,10 @@
import spack
from spack.version import *
+
class PreferredPackages(object):
- _default_order = {'compiler' : [ 'gcc', 'intel', 'clang', 'pgi', 'xlc' ] } # Arbitrary, but consistent
+ # Arbitrary, but consistent
+ _default_order = {'compiler': ['gcc', 'intel', 'clang', 'pgi', 'xlc']}
def __init__(self):
self.preferred = spack.config.get_config('packages')
@@ -35,24 +37,25 @@ class PreferredPackages(object):
# Given a package name, sort component (e.g, version, compiler, ...), and
# a second_key (used by providers), return the list
- def _order_for_package(self, pkgname, component, second_key, test_all=True):
+ def _order_for_package(self, pkgname, component, second_key,
+ test_all=True):
pkglist = [pkgname]
if test_all:
pkglist.append('all')
for pkg in pkglist:
order = self.preferred.get(pkg, {}).get(component, {})
- if type(order) is dict:
+ if isinstance(order, dict) and second_key:
order = order.get(second_key, {})
if not order:
continue
return [str(s).strip() for s in order]
return []
-
# A generic sorting function. Given a package name and sort
# component, return less-than-0, 0, or greater-than-0 if
# a is respectively less-than, equal to, or greater than b.
- def _component_compare(self, pkgname, component, a, b, reverse_natural_compare, second_key):
+ def _component_compare(self, pkgname, component, a, b,
+ reverse_natural_compare, second_key):
if a is None:
return -1
if b is None:
@@ -84,92 +87,102 @@ class PreferredPackages(object):
else:
return 0
-
# A sorting function for specs. Similar to component_compare, but
# a and b are considered to match entries in the sorting list if they
# satisfy the list component.
- def _spec_compare(self, pkgname, component, a, b, reverse_natural_compare, second_key):
- if not a or not a.concrete:
+ def _spec_compare(self, pkgname, component, a, b,
+ reverse_natural_compare, second_key):
+ if not a or (not a.concrete and not second_key):
return -1
- if not b or not b.concrete:
+ if not b or (not b.concrete and not second_key):
return 1
specs = self._spec_for_pkgname(pkgname, component, second_key)
a_index = None
b_index = None
reverse = -1 if reverse_natural_compare else 1
for i, cspec in enumerate(specs):
- if a_index == None and (cspec.satisfies(a) or a.satisfies(cspec)):
+ if a_index is None and (cspec.satisfies(a) or a.satisfies(cspec)):
a_index = i
if b_index:
break
- if b_index == None and (cspec.satisfies(b) or b.satisfies(cspec)):
+ if b_index is None and (cspec.satisfies(b) or b.satisfies(cspec)):
b_index = i
if a_index:
break
- if a_index != None and b_index == None: return -1
- elif a_index == None and b_index != None: return 1
- elif a_index != None and b_index == a_index: return -1 * cmp(a, b)
- elif a_index != None and b_index != None and a_index != b_index: return cmp(a_index, b_index)
- else: return cmp(a, b) * reverse
-
-
+ if a_index is not None and b_index is None:
+ return -1
+ elif a_index is None and b_index is not None:
+ return 1
+ elif a_index is not None and b_index == a_index:
+ return -1 * cmp(a, b)
+ elif (a_index is not None and b_index is not None and
+ a_index != b_index):
+ return cmp(a_index, b_index)
+ else:
+ return cmp(a, b) * reverse
# Given a sort order specified by the pkgname/component/second_key, return
# a list of CompilerSpecs, VersionLists, or Specs for that sorting list.
def _spec_for_pkgname(self, pkgname, component, second_key):
key = (pkgname, component, second_key)
- if not key in self._spec_for_pkgname_cache:
+ if key not in self._spec_for_pkgname_cache:
pkglist = self._order_for_package(pkgname, component, second_key)
if not pkglist:
if component in self._default_order:
pkglist = self._default_order[component]
if component == 'compiler':
- self._spec_for_pkgname_cache[key] = [spack.spec.CompilerSpec(s) for s in pkglist]
+ self._spec_for_pkgname_cache[key] = \
+ [spack.spec.CompilerSpec(s) for s in pkglist]
elif component == 'version':
- self._spec_for_pkgname_cache[key] = [VersionList(s) for s in pkglist]
+ self._spec_for_pkgname_cache[key] = \
+ [VersionList(s) for s in pkglist]
else:
- self._spec_for_pkgname_cache[key] = [spack.spec.Spec(s) for s in pkglist]
+ self._spec_for_pkgname_cache[key] = \
+ [spack.spec.Spec(s) for s in pkglist]
return self._spec_for_pkgname_cache[key]
-
def provider_compare(self, pkgname, provider_str, a, b):
- """Return less-than-0, 0, or greater than 0 if a is respecively less-than, equal-to, or
- greater-than b. A and b are possible implementations of provider_str.
- One provider is less-than another if it is preferred over the other.
- For example, provider_compare('scorep', 'mpi', 'mvapich', 'openmpi') would return -1 if
- mvapich should be preferred over openmpi for scorep."""
- return self._spec_compare(pkgname, 'providers', a, b, False, provider_str)
-
+ """Return less-than-0, 0, or greater than 0 if a is respecively
+ less-than, equal-to, or greater-than b. A and b are possible
+ implementations of provider_str. One provider is less-than another
+ if it is preferred over the other. For example,
+ provider_compare('scorep', 'mpi', 'mvapich', 'openmpi') would
+ return -1 if mvapich should be preferred over openmpi for scorep."""
+ return self._spec_compare(pkgname, 'providers', a, b, False,
+ provider_str)
def spec_has_preferred_provider(self, pkgname, provider_str):
- """Return True iff the named package has a list of preferred provider"""
- return bool(self._order_for_package(pkgname, 'providers', provider_str, False))
-
+ """Return True iff the named package has a list of preferred
+ providers"""
+ return bool(self._order_for_package(pkgname, 'providers',
+ provider_str, False))
def version_compare(self, pkgname, a, b):
"""Return less-than-0, 0, or greater than 0 if version a of pkgname is
- respecively less-than, equal-to, or greater-than version b of pkgname.
- One version is less-than another if it is preferred over the other."""
+ respectively less-than, equal-to, or greater-than version b of
+ pkgname. One version is less-than another if it is preferred over
+ the other."""
return self._spec_compare(pkgname, 'version', a, b, True, None)
-
def variant_compare(self, pkgname, a, b):
"""Return less-than-0, 0, or greater than 0 if variant a of pkgname is
- respecively less-than, equal-to, or greater-than variant b of pkgname.
- One variant is less-than another if it is preferred over the other."""
+ respectively less-than, equal-to, or greater-than variant b of
+ pkgname. One variant is less-than another if it is preferred over
+ the other."""
return self._component_compare(pkgname, 'variant', a, b, False, None)
-
def architecture_compare(self, pkgname, a, b):
- """Return less-than-0, 0, or greater than 0 if architecture a of pkgname is
- respecively less-than, equal-to, or greater-than architecture b of pkgname.
- One architecture is less-than another if it is preferred over the other."""
- return self._component_compare(pkgname, 'architecture', a, b, False, None)
-
+ """Return less-than-0, 0, or greater than 0 if architecture a of pkgname
+ is respectively less-than, equal-to, or greater-than architecture b
+ of pkgname. One architecture is less-than another if it is preferred
+ over the other."""
+ return self._component_compare(pkgname, 'architecture', a, b,
+ False, None)
def compiler_compare(self, pkgname, a, b):
"""Return less-than-0, 0, or greater than 0 if compiler a of pkgname is
- respecively less-than, equal-to, or greater-than compiler b of pkgname.
- One compiler is less-than another if it is preferred over the other."""
+ respecively less-than, equal-to, or greater-than compiler b of
+ pkgname. One compiler is less-than another if it is preferred over
+ the other."""
return self._spec_compare(pkgname, 'compiler', a, b, False, None)
diff --git a/lib/spack/spack/test/__init__.py b/lib/spack/spack/test/__init__.py
index bf46e011b1..a849d5f350 100644
--- a/lib/spack/spack/test/__init__.py
+++ b/lib/spack/spack/test/__init__.py
@@ -32,17 +32,17 @@ from llnl.util.tty.colify import colify
from spack.test.tally_plugin import Tally
"""Names of tests to be included in Spack's test suite"""
-test_names = ['architecture', 'versions', 'url_parse', 'url_substitution',
- 'packages', 'stage',
- 'spec_syntax', 'spec_semantics', 'spec_dag', 'concretize',
- 'multimethod', 'install', 'package_sanity', 'config',
- 'directory_layout', 'pattern', 'python_version', 'git_fetch',
- 'svn_fetch', 'hg_fetch', 'mirror', 'modules', 'url_extrapolate',
- 'cc', 'link_tree', 'spec_yaml', 'optional_deps',
- 'make_executable', 'configure_guess', 'lock', 'database',
- 'namespace_trie', 'yaml', 'sbang', 'environment', 'cmd.find',
- 'cmd.uninstall', 'cmd.test_install',
- 'cmd.test_compiler_cmd', 'cmd.module']
+test_names = [
+ 'architecture', 'versions', 'url_parse', 'url_substitution', 'packages',
+ 'stage', 'spec_syntax', 'spec_semantics', 'spec_dag', 'concretize',
+ 'multimethod', 'install', 'package_sanity', 'config', 'directory_layout',
+ 'pattern', 'python_version', 'git_fetch', 'svn_fetch', 'hg_fetch',
+ 'mirror', 'modules', 'url_extrapolate', 'cc', 'link_tree', 'spec_yaml',
+ 'optional_deps', 'make_executable', 'build_system_guess', 'lock',
+ 'database', 'namespace_trie', 'yaml', 'sbang', 'environment', 'cmd.find',
+ 'cmd.uninstall', 'cmd.test_install', 'cmd.test_compiler_cmd',
+ 'cmd.module'
+]
def list_tests():
diff --git a/lib/spack/spack/test/configure_guess.py b/lib/spack/spack/test/build_system_guess.py
index bad3673e7a..e728a47cf4 100644
--- a/lib/spack/spack/test/configure_guess.py
+++ b/lib/spack/spack/test/build_system_guess.py
@@ -28,14 +28,14 @@ import tempfile
import unittest
from llnl.util.filesystem import *
-from spack.cmd.create import ConfigureGuesser
+from spack.cmd.create import BuildSystemGuesser
from spack.stage import Stage
from spack.test.mock_packages_test import *
from spack.util.executable import which
class InstallTest(unittest.TestCase):
- """Tests the configure guesser in spack create"""
+ """Tests the build system guesser in spack create"""
def setUp(self):
self.tar = which('tar')
@@ -44,12 +44,10 @@ class InstallTest(unittest.TestCase):
os.chdir(self.tmpdir)
self.stage = None
-
def tearDown(self):
shutil.rmtree(self.tmpdir, ignore_errors=True)
os.chdir(self.orig_dir)
-
def check_archive(self, filename, system):
mkdirp('archive')
touch(join_path('archive', filename))
@@ -60,24 +58,24 @@ class InstallTest(unittest.TestCase):
with Stage(url) as stage:
stage.fetch()
- guesser = ConfigureGuesser()
- guesser(stage)
+ guesser = BuildSystemGuesser()
+ guesser(stage, url)
self.assertEqual(system, guesser.build_system)
-
- def test_python(self):
- self.check_archive('setup.py', 'python')
-
-
def test_autotools(self):
self.check_archive('configure', 'autotools')
-
def test_cmake(self):
self.check_archive('CMakeLists.txt', 'cmake')
+ def test_scons(self):
+ self.check_archive('SConstruct', 'scons')
- def test_unknown(self):
- self.check_archive('foobar', 'unknown')
+ def test_python(self):
+ self.check_archive('setup.py', 'python')
+ def test_R(self):
+ self.check_archive('NAMESPACE', 'R')
+ def test_unknown(self):
+ self.check_archive('foobar', 'unknown')
diff --git a/lib/spack/spack/test/modules.py b/lib/spack/spack/test/modules.py
index 6d2e3705bd..135cd028e3 100644
--- a/lib/spack/spack/test/modules.py
+++ b/lib/spack/spack/test/modules.py
@@ -27,7 +27,6 @@ from contextlib import contextmanager
import StringIO
import spack.modules
-import unittest
from spack.test.mock_packages_test import MockPackagesTest
FILE_REGISTRY = collections.defaultdict(StringIO.StringIO)
@@ -266,7 +265,7 @@ class TclTests(MockPackagesTest):
def test_blacklist(self):
spack.modules.CONFIGURATION = configuration_blacklist
- spec = spack.spec.Spec('mpileaks')
+ spec = spack.spec.Spec('mpileaks ^zmpi')
content = self.get_modulefile_content(spec)
self.assertEqual(len([x for x in content if 'is-loaded' in x]), 1)
self.assertEqual(len([x for x in content if 'module load ' in x]), 1)