summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/spack/env/cc12
-rw-r--r--lib/spack/llnl/__init__.py0
-rw-r--r--lib/spack/llnl/util/__init__.py0
-rw-r--r--lib/spack/llnl/util/compare/__init__.py0
-rw-r--r--lib/spack/llnl/util/compare/none_high.py (renamed from lib/spack/spack/util/none_high.py)0
-rw-r--r--lib/spack/llnl/util/compare/none_low.py (renamed from lib/spack/spack/util/none_low.py)0
-rw-r--r--lib/spack/llnl/util/filesystem.py (renamed from lib/spack/spack/util/filesystem.py)18
-rw-r--r--lib/spack/llnl/util/lang.py (renamed from lib/spack/spack/util/lang.py)6
-rw-r--r--lib/spack/llnl/util/tty/__init__.py (renamed from lib/spack/spack/tty.py)28
-rw-r--r--lib/spack/llnl/util/tty/colify.py (renamed from lib/spack/spack/colify.py)0
-rw-r--r--lib/spack/llnl/util/tty/color.py (renamed from lib/spack/spack/color.py)3
-rw-r--r--lib/spack/spack/architecture.py3
-rw-r--r--lib/spack/spack/cmd/__init__.py5
-rw-r--r--lib/spack/spack/cmd/bootstrap.py10
-rw-r--r--lib/spack/spack/cmd/checksum.py5
-rw-r--r--lib/spack/spack/cmd/clean.py3
-rw-r--r--lib/spack/spack/cmd/compilers.py5
-rw-r--r--lib/spack/spack/cmd/create.py3
-rw-r--r--lib/spack/spack/cmd/edit.py3
-rw-r--r--lib/spack/spack/cmd/find.py7
-rw-r--r--lib/spack/spack/cmd/info.py3
-rw-r--r--lib/spack/spack/cmd/list.py2
-rw-r--r--lib/spack/spack/cmd/mirror.py10
-rw-r--r--lib/spack/spack/cmd/providers.py3
-rw-r--r--lib/spack/spack/cmd/spec.py3
-rw-r--r--lib/spack/spack/cmd/test.py8
-rw-r--r--lib/spack/spack/cmd/uninstall.py3
-rw-r--r--lib/spack/spack/cmd/versions.py2
-rw-r--r--lib/spack/spack/compilers/__init__.py3
-rw-r--r--lib/spack/spack/directory_layout.py11
-rw-r--r--lib/spack/spack/globals.py25
-rw-r--r--lib/spack/spack/multimethod.py3
-rw-r--r--lib/spack/spack/package.py85
-rw-r--r--lib/spack/spack/packages/__init__.py11
-rw-r--r--lib/spack/spack/packages/graphlib.py14
-rw-r--r--lib/spack/spack/packages/launchmon/__init__.py (renamed from lib/spack/spack/validate.py)31
-rw-r--r--lib/spack/spack/packages/launchmon/patch.lmon_install_dir147
-rw-r--r--lib/spack/spack/packages/mrnet.py14
-rw-r--r--lib/spack/spack/packages/stat.py34
-rw-r--r--lib/spack/spack/patch.py7
-rw-r--r--lib/spack/spack/relations.py3
-rw-r--r--lib/spack/spack/spec.py7
-rw-r--r--lib/spack/spack/stage.py16
-rw-r--r--lib/spack/spack/test/__init__.py6
-rw-r--r--lib/spack/spack/test/mock_packages_test.py6
-rw-r--r--lib/spack/spack/test/packages.py6
-rw-r--r--lib/spack/spack/test/spec_dag.py3
-rw-r--r--lib/spack/spack/test/stage.py30
-rw-r--r--lib/spack/spack/url.py6
-rw-r--r--lib/spack/spack/util/compression.py11
-rw-r--r--lib/spack/spack/util/executable.py2
-rw-r--r--lib/spack/spack/util/prefix.py40
-rw-r--r--lib/spack/spack/util/web.py3
-rw-r--r--lib/spack/spack/version.py4
54 files changed, 473 insertions, 200 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index 47a5bcf900..0711c873e3 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -18,7 +18,7 @@ if not spack_lib:
# Grab a minimal set of spack packages
sys.path.append(spack_lib)
from spack.compilation import *
-import spack.tty as tty
+import llnl.util.tty as tty
spack_prefix = get_env_var("SPACK_PREFIX")
spack_build_root = get_env_var("SPACK_BUILD_ROOT")
@@ -28,7 +28,16 @@ spack_env_path = get_path("SPACK_ENV_PATH")
# Figure out what type of operation we're doing
command = os.path.basename(sys.argv[0])
+
cpp, cc, ccld, ld, version_check = range(5)
+
+########################################################################
+# TODO: this can to be removed once JIRA issue SPACK-16 is resolved
+#
+if command == 'CC':
+ command = 'c++'
+########################################################################
+
if command == 'cpp':
mode = cpp
elif command == 'ld':
@@ -93,6 +102,7 @@ for item in ['.'] + spack_env_path:
os.environ["PATH"] = ":".join(clean_path)
full_command = [command] + arguments
+
if spack_debug:
input_log = os.path.join(spack_build_root, 'spack_cc_in.log')
output_log = os.path.join(spack_build_root, 'spack_cc_out.log')
diff --git a/lib/spack/llnl/__init__.py b/lib/spack/llnl/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/spack/llnl/__init__.py
diff --git a/lib/spack/llnl/util/__init__.py b/lib/spack/llnl/util/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/spack/llnl/util/__init__.py
diff --git a/lib/spack/llnl/util/compare/__init__.py b/lib/spack/llnl/util/compare/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/spack/llnl/util/compare/__init__.py
diff --git a/lib/spack/spack/util/none_high.py b/lib/spack/llnl/util/compare/none_high.py
index 78b41cbaf6..78b41cbaf6 100644
--- a/lib/spack/spack/util/none_high.py
+++ b/lib/spack/llnl/util/compare/none_high.py
diff --git a/lib/spack/spack/util/none_low.py b/lib/spack/llnl/util/compare/none_low.py
index 307bcc8a26..307bcc8a26 100644
--- a/lib/spack/spack/util/none_low.py
+++ b/lib/spack/llnl/util/compare/none_low.py
diff --git a/lib/spack/spack/util/filesystem.py b/lib/spack/llnl/util/filesystem.py
index c84a9fd608..2ec8c61cfa 100644
--- a/lib/spack/spack/util/filesystem.py
+++ b/lib/spack/llnl/util/filesystem.py
@@ -29,7 +29,7 @@ import errno
import getpass
from contextlib import contextmanager, closing
-import spack.tty as tty
+import llnl.util.tty as tty
from spack.util.compression import ALLOWED_ARCHIVE_TYPES
@@ -70,14 +70,10 @@ def mkdirp(*paths):
raise OSError(errno.EEXIST, "File alredy exists", path)
-def new_path(prefix, *args):
+def join_path(prefix, *args):
path = str(prefix)
for elt in args:
path = os.path.join(path, str(elt))
-
- if re.search(r'\s', path):
- tty.die("Invalid path: '%s'. Use a path without whitespace." % path)
-
return path
@@ -89,16 +85,6 @@ def ancestor(dir, n=1):
return parent
-def stem(path):
- """Get the part of a path that does not include its compressed
- type extension."""
- for type in ALLOWED_ARCHIVE_TYPES:
- suffix = r'\.%s$' % type
- if re.search(suffix, path):
- return re.sub(suffix, "", path)
- return path
-
-
def can_access(file_name):
"""True if we have read/write access to the file."""
return os.access(file_name, os.R_OK|os.W_OK)
diff --git a/lib/spack/spack/util/lang.py b/lib/spack/llnl/util/lang.py
index b77182ba7f..034c3b374d 100644
--- a/lib/spack/spack/util/lang.py
+++ b/lib/spack/llnl/util/lang.py
@@ -27,12 +27,10 @@ import re
import sys
import functools
import inspect
-from spack.util.filesystem import new_path
# Ignore emacs backups when listing modules
ignore_modules = [r'^\.#', '~$']
-
def caller_locals():
"""This will return the locals of the *parent* of the caller.
This allows a fucntion to insert variables into its caller's
@@ -114,9 +112,9 @@ def list_modules(directory, **kwargs):
if name == '__init__.py':
continue
- path = new_path(directory, name)
+ path = os.path.join(directory, name)
if list_directories and os.path.isdir(path):
- init_py = new_path(path, '__init__.py')
+ init_py = os.path.join(path, '__init__.py')
if os.path.isfile(init_py):
yield name
diff --git a/lib/spack/spack/tty.py b/lib/spack/llnl/util/tty/__init__.py
index b9ad3f12bf..afc4b59a63 100644
--- a/lib/spack/spack/tty.py
+++ b/lib/spack/llnl/util/tty/__init__.py
@@ -23,10 +23,11 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import sys
-import spack
-from spack.color import *
+from llnl.util.tty.color import *
-indent = " "
+debug = False
+verbose = False
+indent = " "
def msg(message, *args):
cprint("@*b{==>} %s" % cescape(message))
@@ -42,13 +43,13 @@ def info(message, *args, **kwargs):
def verbose(message, *args):
- if spack.verbose:
- info(str(message), *args, format='c')
+ if verbose:
+ info(message, *args, format='c')
def debug(*args):
- if spack.debug:
- info("Debug: " + str(message), *args, format='*g')
+ if debug:
+ info("Debug: " + message, *args, format='*g')
def error(message, *args):
@@ -64,19 +65,6 @@ def die(message, *args):
sys.exit(1)
-def pkg(message):
- """Outputs a message with a package icon."""
- import platform
- from version import Version
-
- mac_ver = platform.mac_ver()[0]
- if mac_ver and Version(mac_ver) >= Version('10.7'):
- print u"\U0001F4E6" + indent,
- else:
- cwrite('@*g{[+]} ')
- print message
-
-
def get_number(prompt, **kwargs):
default = kwargs.get('default', None)
abort = kwargs.get('abort', None)
diff --git a/lib/spack/spack/colify.py b/lib/spack/llnl/util/tty/colify.py
index 1f66416e69..1f66416e69 100644
--- a/lib/spack/spack/colify.py
+++ b/lib/spack/llnl/util/tty/colify.py
diff --git a/lib/spack/spack/color.py b/lib/spack/llnl/util/tty/color.py
index 9d75824aa8..14974a1014 100644
--- a/lib/spack/spack/color.py
+++ b/lib/spack/llnl/util/tty/color.py
@@ -74,9 +74,8 @@ To output an @, use '@@'. To output a } inside braces, use '}}'.
"""
import re
import sys
-import spack.error
-class ColorParseError(spack.error.SpackError):
+class ColorParseError(Exception):
"""Raised when a color format fails to parse."""
def __init__(self, message):
super(ColorParseError, self).__init__(message)
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index 92e4b2742d..7fbf1dadcf 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -25,10 +25,11 @@
import os
import platform as py_platform
+from llnl.util.lang import memoized
+
import spack
import spack.error as serr
from spack.version import Version
-from spack.util.lang import memoized
class InvalidSysTypeError(serr.SpackError):
diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py
index bfd69bbe56..537db536dd 100644
--- a/lib/spack/spack/cmd/__init__.py
+++ b/lib/spack/spack/cmd/__init__.py
@@ -26,10 +26,11 @@ import os
import re
import sys
+import llnl.util.tty as tty
+from llnl.util.lang import attr_setdefault
+
import spack
import spack.spec
-import spack.tty as tty
-from spack.util.lang import attr_setdefault
# cmd has a submodule called "list" so preserve the python list module
python_list = list
diff --git a/lib/spack/spack/cmd/bootstrap.py b/lib/spack/spack/cmd/bootstrap.py
index 381f4c717c..11fc67e519 100644
--- a/lib/spack/spack/cmd/bootstrap.py
+++ b/lib/spack/spack/cmd/bootstrap.py
@@ -24,9 +24,11 @@
##############################################################################
import os
from subprocess import check_call, check_output
+
+import llnl.util.tty as tty
+
import spack
-from spack import new_path
-import spack.tty as tty
+from spack import join_path
description = "Create a new installation of spack in another prefix"
@@ -35,7 +37,7 @@ def setup_parser(subparser):
def get_origin_url():
- git_dir = new_path(spack.prefix, '.git')
+ git_dir = join_path(spack.prefix, '.git')
origin_url = check_output(
['git', '--git-dir=%s' % git_dir, 'config', '--get', 'remote.origin.url'])
return origin_url.strip()
@@ -47,7 +49,7 @@ def bootstrap(parser, args):
tty.msg("Fetching spack from origin: %s" % origin_url)
- if os.path.exists(new_path(prefix, '.git')):
+ if os.path.exists(join_path(prefix, '.git')):
tty.die("There already seems to be a git repository in %s" % prefix)
files_in_the_way = os.listdir(prefix)
diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py
index abd161182c..4867d1b520 100644
--- a/lib/spack/spack/cmd/checksum.py
+++ b/lib/spack/spack/cmd/checksum.py
@@ -29,13 +29,14 @@ import hashlib
from pprint import pprint
from subprocess import CalledProcessError
+import llnl.util.tty as tty
+from llnl.util.tty.colify import colify
+
import spack
import spack.cmd
-import spack.tty as tty
import spack.packages as packages
import spack.util.crypto
from spack.stage import Stage, FailedDownloadError
-from spack.colify import colify
from spack.version import *
description ="Checksum available versions of a package to update a package file."
diff --git a/lib/spack/spack/cmd/clean.py b/lib/spack/spack/cmd/clean.py
index b86c3e502f..d54b529d3c 100644
--- a/lib/spack/spack/cmd/clean.py
+++ b/lib/spack/spack/cmd/clean.py
@@ -24,9 +24,10 @@
##############################################################################
import argparse
+import llnl.util.tty as tty
+
import spack.cmd
import spack.packages as packages
-import spack.tty as tty
import spack.stage as stage
description = "Remove staged files for packages"
diff --git a/lib/spack/spack/cmd/compilers.py b/lib/spack/spack/cmd/compilers.py
index 8b1fb4d03a..c3f204e3d3 100644
--- a/lib/spack/spack/cmd/compilers.py
+++ b/lib/spack/spack/cmd/compilers.py
@@ -22,9 +22,10 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
+import llnl.util.tty as tty
+from llnl.util.tty.colify import colify
+
import spack.compilers
-import spack.tty as tty
-from spack.colify import colify
description = "List available compilers"
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index 6d0b3f095e..236485f9a1 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -28,11 +28,12 @@ import hashlib
import re
from contextlib import closing
+import llnl.util.tty as tty
+
import spack
import spack.cmd
import spack.package
import spack.packages as packages
-import spack.tty as tty
import spack.url
import spack.util.crypto as crypto
import spack.cmd.checksum
diff --git a/lib/spack/spack/cmd/edit.py b/lib/spack/spack/cmd/edit.py
index b04899ad84..b6373872c0 100644
--- a/lib/spack/spack/cmd/edit.py
+++ b/lib/spack/spack/cmd/edit.py
@@ -26,9 +26,10 @@ import os
import string
from contextlib import closing
+import llnl.util.tty as tty
+
import spack
import spack.packages as packages
-import spack.tty as tty
description = "Open package files in $EDITOR"
diff --git a/lib/spack/spack/cmd/find.py b/lib/spack/spack/cmd/find.py
index 95abbb72bd..3db0608d6b 100644
--- a/lib/spack/spack/cmd/find.py
+++ b/lib/spack/spack/cmd/find.py
@@ -26,12 +26,13 @@ import collections
import argparse
from StringIO import StringIO
+from llnl.util.tty.colify import colify
+from llnl.util.tty.color import *
+
import spack
import spack.spec
import spack.packages as packages
-import spack.colify
-from spack.color import *
-from spack.colify import colify
+
description ="Find installed spack packages"
diff --git a/lib/spack/spack/cmd/info.py b/lib/spack/spack/cmd/info.py
index b4d9a8339d..3a17b2ce3c 100644
--- a/lib/spack/spack/cmd/info.py
+++ b/lib/spack/spack/cmd/info.py
@@ -24,10 +24,9 @@
##############################################################################
import re
import textwrap
-
+from llnl.util.tty.colify import colify
import spack
import spack.packages as packages
-from spack.colify import colify
description = "Get detailed information on a particular package"
diff --git a/lib/spack/spack/cmd/list.py b/lib/spack/spack/cmd/list.py
index 2cfdd9863d..15e1581868 100644
--- a/lib/spack/spack/cmd/list.py
+++ b/lib/spack/spack/cmd/list.py
@@ -23,7 +23,7 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import spack.packages as packages
-from spack.colify import colify
+from llnl.util.tty.colify import colify
description ="List available spack packages"
diff --git a/lib/spack/spack/cmd/mirror.py b/lib/spack/spack/cmd/mirror.py
index ec91ef0fd5..098b1c3bf8 100644
--- a/lib/spack/spack/cmd/mirror.py
+++ b/lib/spack/spack/cmd/mirror.py
@@ -26,12 +26,14 @@ import os
import shutil
import argparse
+import llnl.util.tty as tty
+from llnl.util.filesystem import mkdirp, join_path
+
import spack.packages as packages
import spack.cmd
-import spack.tty as tty
from spack.stage import Stage
-from spack.util.filesystem import mkdirp, new_path
+
description = "Create a directory full of package tarballs that can be used as a spack mirror."
@@ -66,7 +68,7 @@ def mirror(parser, args):
continue
# create a subdir for the current package.
- pkg_path = new_path(args.directory, pkg_name)
+ pkg_path = join_path(args.directory, pkg_name)
mkdirp(pkg_path)
# Download all the tarballs using Stages, then move them into place
@@ -76,7 +78,7 @@ def mirror(parser, args):
try:
stage.fetch()
basename = os.path.basename(stage.archive_file)
- final_dst = new_path(pkg_path, basename)
+ final_dst = join_path(pkg_path, basename)
os.chdir(working_dir)
shutil.move(stage.archive_file, final_dst)
diff --git a/lib/spack/spack/cmd/providers.py b/lib/spack/spack/cmd/providers.py
index dc40b6b9ff..b59950aeb3 100644
--- a/lib/spack/spack/cmd/providers.py
+++ b/lib/spack/spack/cmd/providers.py
@@ -25,9 +25,10 @@
import os
import argparse
+from llnl.util.tty.colify import colify
+
import spack.cmd
import spack.packages
-from spack.colify import colify
description ="List packages that provide a particular virtual package"
diff --git a/lib/spack/spack/cmd/spec.py b/lib/spack/spack/cmd/spec.py
index fcff743026..fb5a900c3f 100644
--- a/lib/spack/spack/cmd/spec.py
+++ b/lib/spack/spack/cmd/spec.py
@@ -25,7 +25,8 @@
import argparse
import spack.cmd
-import spack.tty as tty
+import llnl.util.tty as tty
+
import spack.url as url
import spack
diff --git a/lib/spack/spack/cmd/test.py b/lib/spack/spack/cmd/test.py
index 41cba4b66c..16d693aa21 100644
--- a/lib/spack/spack/cmd/test.py
+++ b/lib/spack/spack/cmd/test.py
@@ -22,12 +22,14 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
+from pprint import pprint
+
+from llnl.util.tty.colify import colify
+from llnl.util.lang import list_modules
+
import spack
import spack.packages as packages
import spack.test
-from spack.util.lang import list_modules
-from spack.colify import colify
-from pprint import pprint
description ="Run unit tests"
diff --git a/lib/spack/spack/cmd/uninstall.py b/lib/spack/spack/cmd/uninstall.py
index c30746b0d6..e47b4d7f7a 100644
--- a/lib/spack/spack/cmd/uninstall.py
+++ b/lib/spack/spack/cmd/uninstall.py
@@ -24,8 +24,9 @@
##############################################################################
import argparse
+import llnl.util.tty as tty
+
import spack.cmd
-import spack.tty as tty
import spack.packages as packages
description="Remove an installed package"
diff --git a/lib/spack/spack/cmd/versions.py b/lib/spack/spack/cmd/versions.py
index 9ecb9875c2..1f0da9fbd8 100644
--- a/lib/spack/spack/cmd/versions.py
+++ b/lib/spack/spack/cmd/versions.py
@@ -23,8 +23,8 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
+from llnl.util.tty.colify import colify
import spack.packages as packages
-from spack.colify import colify
description ="List available versions of a package"
diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py
index 369171a59b..5448e709c4 100644
--- a/lib/spack/spack/compilers/__init__.py
+++ b/lib/spack/spack/compilers/__init__.py
@@ -25,10 +25,9 @@
#
# This needs to be expanded for full compiler support.
#
-
+from llnl.util.lang import memoized, list_modules
import spack
import spack.compilers.gcc
-from spack.util.lang import memoized, list_modules
@memoized
def supported_compilers():
diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py
index bc4ecf802a..2e4b6f89c8 100644
--- a/lib/spack/spack/directory_layout.py
+++ b/lib/spack/spack/directory_layout.py
@@ -24,12 +24,13 @@
##############################################################################
import re
import os
-import os.path
import exceptions
import hashlib
+import shutil
+from contextlib import closing
+from llnl.util.filesystem import join_path, mkdirp
from spack.spec import Spec
-from spack.util.filesystem import *
from spack.error import SpackError
@@ -138,7 +139,7 @@ class SpecHashDirectoryLayout(DirectoryLayout):
def relative_path_for_spec(self, spec):
_check_concrete(spec)
- path = new_path(
+ path = join_path(
spec.architecture,
spec.compiler,
"%s@%s%s" % (spec.name, spec.version, spec.variants))
@@ -168,7 +169,7 @@ class SpecHashDirectoryLayout(DirectoryLayout):
_check_concrete(spec)
path = self.path_for_spec(spec)
- spec_file_path = new_path(path, self.spec_file)
+ spec_file_path = join_path(path, self.spec_file)
if os.path.isdir(path):
if not os.path.isfile(spec_file_path):
@@ -199,7 +200,7 @@ class SpecHashDirectoryLayout(DirectoryLayout):
for path in traverse_dirs_at_depth(self.root, 3):
arch, compiler, last_dir = path
- spec_file_path = new_path(
+ spec_file_path = join_path(
self.root, arch, compiler, last_dir, self.spec_file)
if os.path.exists(spec_file_path):
spec = self.read_spec(spec_file_path)
diff --git a/lib/spack/spack/globals.py b/lib/spack/spack/globals.py
index 40bb50f219..990a2ff417 100644
--- a/lib/spack/spack/globals.py
+++ b/lib/spack/spack/globals.py
@@ -24,8 +24,9 @@
##############################################################################
import os
+from llnl.util.filesystem import *
+
from spack.version import Version
-from spack.util.filesystem import *
from spack.util.executable import *
from spack.directory_layout import SpecHashDirectoryLayout
from spack.concretize import DefaultConcretizer
@@ -34,20 +35,20 @@ from spack.concretize import DefaultConcretizer
prefix = ancestor(__file__, 4)
# The spack script itself
-spack_file = new_path(prefix, "bin", "spack")
+spack_file = join_path(prefix, "bin", "spack")
# spack directory hierarchy
-lib_path = new_path(prefix, "lib", "spack")
-env_path = new_path(lib_path, "env")
-module_path = new_path(lib_path, "spack")
-packages_path = new_path(module_path, "packages")
-compilers_path = new_path(module_path, "compilers")
-test_path = new_path(module_path, "test")
+lib_path = join_path(prefix, "lib", "spack")
+env_path = join_path(lib_path, "env")
+module_path = join_path(lib_path, "spack")
+packages_path = join_path(module_path, "packages")
+compilers_path = join_path(module_path, "compilers")
+test_path = join_path(module_path, "test")
-var_path = new_path(prefix, "var", "spack")
-stage_path = new_path(var_path, "stage")
+var_path = join_path(prefix, "var", "spack")
+stage_path = join_path(var_path, "stage")
-install_path = new_path(prefix, "opt")
+install_path = join_path(prefix, "opt")
#
# This controls how spack lays out install prefixes and
@@ -116,7 +117,7 @@ sys_type = None
# For no mirrors:
# mirrors = []
#
-mirrors = []
+mirrors = ['file:///Users/gamblin2/mirror']
# Important environment variables
SPACK_NO_PARALLEL_MAKE = 'SPACK_NO_PARALLEL_MAKE'
diff --git a/lib/spack/spack/multimethod.py b/lib/spack/spack/multimethod.py
index 710c790b63..8d91e4f86d 100644
--- a/lib/spack/spack/multimethod.py
+++ b/lib/spack/spack/multimethod.py
@@ -47,9 +47,10 @@ import sys
import functools
import collections
+from llnl.util.lang import *
+
import spack.architecture
import spack.error
-from spack.util.lang import *
from spack.spec import parse_anonymous_spec, Spec
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 24c3ffd35b..68e4e30b3b 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -39,23 +39,28 @@ import re
import subprocess
import platform as py_platform
import shutil
+import multiprocessing
+from urlparse import urlparse
+
+import llnl.util.tty as tty
+from llnl.util.tty.color import cwrite
+from llnl.util.filesystem import touch
+from llnl.util.lang import *
from spack import *
import spack.spec
import spack.error
-import packages
-import tty
-import validate
-import multiprocessing
-import url
-
+import spack.packages as packages
+import spack.url as url
import spack.util.crypto as crypto
from spack.version import *
from spack.stage import Stage
-from spack.util.lang import *
from spack.util.web import get_pages
from spack.util.environment import *
-from spack.util.filesystem import touch
+from spack.util.compression import allowed_archive
+
+"""Allowed URL schemes for spack packages."""
+_ALLOWED_URL_SCHEMES = ["http", "https", "ftp", "file"]
class Package(object):
@@ -321,6 +326,9 @@ class Package(object):
"""Controls whether install and uninstall check deps before running."""
ignore_dependencies = False
+ """Dirty hack for forcing packages with uninterpretable URLs"""
+ force_url = False
+
def __init__(self, spec):
# These attributes are required for all packages.
@@ -337,7 +345,7 @@ class Package(object):
self.name = self.name[self.name.rindex('.') + 1:]
# Make sure URL is an allowed type
- validate.url(self.url)
+ validate_package_url(self.url)
# patch up the URL with a new version if the spec version is concrete
if self.spec.versions.concrete:
@@ -552,11 +560,15 @@ class Package(object):
override this, e.g. for boost versions where you need to ensure that there
are _'s in the download URL.
"""
+ if self.force_url:
+ return self.default_version
return str(version)
def url_for_version(self, version):
"""Gives a URL that you can download a new version of this package from."""
+ if self.force_url:
+ return self.url
return url.substitute_version(self.__class__.url, self.url_version(version))
@@ -620,8 +632,8 @@ class Package(object):
# Construct paths to special files in the archive dir used to
# keep track of whether patches were successfully applied.
archive_dir = self.stage.expanded_archive_path
- good_file = new_path(archive_dir, '.spack_patched')
- bad_file = new_path(archive_dir, '.spack_patch_failed')
+ good_file = join_path(archive_dir, '.spack_patched')
+ bad_file = join_path(archive_dir, '.spack_patch_failed')
# If we encounter an archive that failed to patch, restage it
# so that we can apply all the patches again.
@@ -664,7 +676,7 @@ class Package(object):
if os.path.exists(self.prefix):
tty.msg("%s is already installed." % self.name)
- tty.pkg(self.prefix)
+ print_pkg(self.prefix)
return
if not self.ignore_dependencies:
@@ -678,27 +690,28 @@ class Package(object):
self.add_commands_to_module()
tty.msg("Building %s." % self.name)
- try:
- # create the install directory (allow the layout to handle this in
- # case it needs to add extra files)
- spack.install_layout.make_path_for_spec(self.spec)
+ # create the install directory (allow the layout to handle this in
+ # case it needs to add extra files)
+ spack.install_layout.make_path_for_spec(self.spec)
+
+ try:
self.install(self.spec, self.prefix)
if not os.path.isdir(self.prefix):
tty.die("Install failed for %s. No install dir created." % self.name)
+ tty.msg("Successfully installed %s" % self.name)
+ print_pkg(self.prefix)
+
except Exception, e:
- if not self.dirty:
- self.remove_prefix()
+ self.remove_prefix()
raise
- tty.msg("Successfully installed %s" % self.name)
- tty.pkg(self.prefix)
-
- # Once the install is done, destroy the stage where we built it,
- # unless the user wants it kept around.
- if not self.dirty:
- self.stage.destroy()
+ finally:
+ # Once the install is done, destroy the stage where we built it,
+ # unless the user wants it kept around.
+ if not self.dirty:
+ self.stage.destroy()
def setup_install_environment(self):
@@ -713,7 +726,7 @@ class Package(object):
# in directories called "case*" within the env directory.
env_paths = [env_path]
for file in os.listdir(env_path):
- path = new_path(env_path, file)
+ path = join_path(env_path, file)
if file.startswith("case") and os.path.isdir(path):
env_paths.append(path)
path_put_first("PATH", env_paths)
@@ -883,6 +896,26 @@ class MakeExecutable(Executable):
super(MakeExecutable, self).__call__(*args, **kwargs)
+def validate_package_url(url_string):
+ """Determine whether spack can handle a particular URL or not."""
+ url = urlparse(url_string)
+ if url.scheme not in _ALLOWED_URL_SCHEMES:
+ tty.die("Invalid protocol in URL: '%s'" % url_string)
+
+ if not allowed_archive(url_string):
+ tty.die("Invalid file type in URL: '%s'" % url_string)
+
+
+def print_pkg(message):
+ """Outputs a message with a package icon."""
+ mac_ver = py_platform.mac_ver()[0]
+ if mac_ver and Version(mac_ver) >= Version('10.7'):
+ print u"\U0001F4E6" + tty.indent,
+ else:
+ cwrite('@*g{[+]} ')
+ print message
+
+
class InvalidPackageDependencyError(spack.error.SpackError):
"""Raised when package specification is inconsistent with requirements of
its dependencies."""
diff --git a/lib/spack/spack/packages/__init__.py b/lib/spack/spack/packages/__init__.py
index 488aea2423..5731fb0d99 100644
--- a/lib/spack/spack/packages/__init__.py
+++ b/lib/spack/spack/packages/__init__.py
@@ -29,12 +29,13 @@ import string
import inspect
import glob
+import llnl.util.tty as tty
+from llnl.util.filesystem import join_path
+from llnl.util.lang import list_modules
+
import spack
import spack.error
import spack.spec
-import spack.tty as tty
-from spack.util.filesystem import new_path
-from spack.util.lang import list_modules
# Valid package names can contain '-' but can't start with it.
valid_package_re = r'^\w[\w-]*$'
@@ -212,7 +213,7 @@ def validate_package_name(pkg_name):
def dirname_for_package_name(pkg_name):
"""Get the directory name for a particular package would use, even if it's a
foo.py package and not a directory with a foo/__init__.py file."""
- return new_path(spack.packages_path, pkg_name)
+ return join_path(spack.packages_path, pkg_name)
def filename_for_package_name(pkg_name):
@@ -236,7 +237,7 @@ def filename_for_package_name(pkg_name):
pkg_dir = dirname_for_package_name(pkg_name)
if os.path.isdir(pkg_dir):
- init_file = new_path(pkg_dir, '__init__.py')
+ init_file = join_path(pkg_dir, '__init__.py')
return init_file
else:
pkg_file = "%s.py" % pkg_dir
diff --git a/lib/spack/spack/packages/graphlib.py b/lib/spack/spack/packages/graphlib.py
new file mode 100644
index 0000000000..c959135147
--- /dev/null
+++ b/lib/spack/spack/packages/graphlib.py
@@ -0,0 +1,14 @@
+from spack import *
+
+class Graphlib(Package):
+ """Library to create, manipulate, and export graphs Graphlib."""
+ homepage = "http://https://github.com/lee218llnl/graphlib"
+ url = "https://github.com/lee218llnl/graphlib/archive/v2.0.0.tar.gz"
+
+ versions = { '2.0.0' : '43c6df84f1d38ba5a5dce0ae19371a70', }
+
+ def install(self, spec, prefix):
+ cmake(".", *std_cmake_args)
+
+ make()
+ make("install")
diff --git a/lib/spack/spack/validate.py b/lib/spack/spack/packages/launchmon/__init__.py
index 5bdc7b7f66..e2b82610fd 100644
--- a/lib/spack/spack/validate.py
+++ b/lib/spack/spack/packages/launchmon/__init__.py
@@ -1,9 +1,9 @@
##############################################################################
-# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
+# Copyright (c) 2014, 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.
+# Written by Matthew LeGendre, legendre1@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://scalability-llnl.github.io/spack
@@ -22,17 +22,24 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
-import tty
-from urlparse import urlparse
+from spack import *
-from spack.util.compression import allowed_archive
+class Launchmon(Package):
+ homepage = "http://sourceforge.net/projects/launchmon"
+ url = "http://sourceforge.net/code-snapshots/svn/l/la/launchmon/code/launchmon-code-481-branches-launchmon-1.0-release.zip"
+ force_url = True
+ list_url = "http://sourceforge.net/p/launchmon/code/HEAD/tree"
-ALLOWED_SCHEMES = ["http", "https", "ftp", "file"]
+ #versions = {'1.0.0' : 'a0e5bfb7d82dc708d58bdbf93697886c'}
+ versions = {'1.0.0' : '9d1184397d3081b94e2c0577c3c605e5'}
+ patch('patch.lmon_install_dir', level=0)
-def url(url_string):
- url = urlparse(url_string)
- if url.scheme not in ALLOWED_SCHEMES:
- tty.die("Invalid protocol in URL: '%s'" % url_string)
+ def install(self, spec, prefix):
+ configure("--prefix=" + prefix)
- if not allowed_archive(url_string):
- tty.die("Invalid file type in URL: '%s'" % url_string)
+ # TODO: remove once Jira SPACK-19 is fixed
+ import shutil
+ shutil.copy2('/usr/bin/libtool', 'libtool')
+
+ make()
+ make("install")
diff --git a/lib/spack/spack/packages/launchmon/patch.lmon_install_dir b/lib/spack/spack/packages/launchmon/patch.lmon_install_dir
new file mode 100644
index 0000000000..8a1d93fdc9
--- /dev/null
+++ b/lib/spack/spack/packages/launchmon/patch.lmon_install_dir
@@ -0,0 +1,147 @@
+Index: launchmon/src/linux/lmon_api/Makefile.am
+===================================================================
+--- launchmon/src/linux/lmon_api/Makefile.am (revision 481)
++++ launchmon/src/linux/lmon_api/Makefile.am (working copy)
+@@ -80,13 +80,10 @@
+ libmonfeapi_la_CFLAGS = $(AM_CFLAGS)
+ libmonfeapi_la_CXXFLAGS = $(AM_CXXFLAGS)
+
+-libmonfeapi_la_LDFLAGS = -L$(top_srcdir)/@COMMLOC@ \
+- -L$(top_srcdir)/@GCRYPTLOC@ \
+- -L$(top_srcdir)/@GPGERRLOC@ \
+- $(AM_LDFLAGS) \
+- -version-info @LMON_CURRENT@:@LMON_REVISION@:@LMON_AGE@
++libmonfeapi_la_LDFLAGS = $(AM_LDFLAGS) \
++ -version-info @LMON_CURRENT@:@LMON_REVISION@:@LMON_AGE@
+
+-libmonfeapi_la_LIBADD = @LIBPTHREAD@ @LIBCOMM@ @LIBGCRYPT@ @LIBGPGERR@ @LIBRT@
++libmonfeapi_la_LIBADD = @LIBPTHREAD@ $(top_builddir)/@COMMLOC@/@LIBCOMM@ $(top_builddir)/@GCRYPTLOC@/@LIBGCRYPT@ $(top_builddir)/@GPGERRLOC@/@LIBGPGERR@ @LIBRT@
+
+ libmonbeapi_la_SOURCES = lmon_be.cxx \
+ lmon_daemon_internal.cxx \
+@@ -113,13 +110,10 @@
+ libmonbeapi_la_CFLAGS = $(AM_CFLAGS)
+ libmonbeapi_la_CXXFLAGS = $(AM_CXXFLAGS)
+
+-libmonbeapi_la_LDFLAGS = -L$(top_srcdir)/@COMMLOC@ \
+- -L$(top_srcdir)/@GCRYPTLOC@ \
+- -L$(top_srcdir)/@GPGERRLOC@ \
+- $(AM_LDFLAGS) \
++libmonbeapi_la_LDFLAGS = $(AM_LDFLAGS) \
+ -version-info @LMON_CURRENT@:@LMON_REVISION@:@LMON_AGE@
+
+-libmonbeapi_la_LIBADD = @LIBCOMM@ @LIBGCRYPT@ @LIBGPGERR@
++libmonbeapi_la_LIBADD = $(top_builddir)/@COMMLOC@/@LIBCOMM@ $(top_builddir)/@GCRYPTLOC@/@LIBGCRYPT@ $(top_builddir)/@GPGERRLOC@/@LIBGPGERR@
+
+
+ #
+@@ -146,10 +140,8 @@
+
+ libmonmwapi_la_CXXFLAGS = $(AM_CXXFLAGS)
+
+-libmonmwapi_la_LDFLAGS = -L$(top_srcdir)/@COMMLOC@ \
+- -L$(top_srcdir)/@GCRYPTLOC@ \
+- -L$(top_srcdir)/@GPGERRLOC@ \
+- $(AM_LDFLAGS) \
++libmonmwapi_la_LDFLAGS = $(AM_LDFLAGS) \
+ -version-info @LMON_CURRENT@:@LMON_REVISION@:@LMON_AGE@
+
+-libmonmwapi_la_LIBADD = @LIBCOMM@ @LIBGCRYPT@ @LIBGPGERR@
++
++libmonmwapi_la_LIBADD = $(top_builddir)/@COMMLOC@/@LIBCOMM@ $(top_builddir)/@GCRYPTLOC@/@LIBGCRYPT@ $(top_builddir)/@GPGERRLOC@/@LIBGPGERR@
+Index: tools/cobo/test/Makefile.am
+===================================================================
+--- tools/cobo/test/Makefile.am (revision 481)
++++ tools/cobo/test/Makefile.am (working copy)
+@@ -37,12 +37,12 @@
+
+ client_SOURCES = client.c
+
+-client_LDFLAGS = -L$(top_srcdir)/@COMMLOC@
++client_LDFLAGS =
+
+-client_LDADD = @LIBCOMM@
++client_LDADD = $(top_srcdir)/@COMMLOC@/@LIBCOMM@
+
+ server_rsh_SOURCES = server_rsh.c
+
+-server_rsh_LDFLAGS = -L$(top_srcdir)/@COMMLOC@
++server_rsh_LDFLAGS =
+
+-server_rsh_LDADD = @LIBCOMM@
++server_rsh_LDADD = $(top_srcdir)/@COMMLOC@/@LIBCOMM@
+Index: tools/pmgr_collective/test/Makefile.am
+===================================================================
+--- tools/pmgr_collective/test/Makefile.am (revision 481)
++++ tools/pmgr_collective/test/Makefile.am (working copy)
+@@ -31,18 +31,18 @@
+ ## Jun 10 2008 DHA: Copied from the old Makefile.
+ ##
+
+-INCLUDES = -I$(top_srcdir)/@COMMLOC@
++INCLUDES =
+
+ noinst_PROGRAMS = client mpirun_rsh
+
+ client_SOURCES = client.c
+
+-client_LDFLAGS = -L$(top_srcdir)/@COMMLOC@
++client_LDFLAGS =
+
+-client_LDADD = @LIBCOMM@
++client_LDADD = @COMMLOC@/@LIBCOMM@
+
+ mpirun_rsh_SOURCES = mpirun_rsh.c
+
+-mpirun_rsh_LDFLAGS = -L$(top_srcdir)/@COMMLOC@
++mpirun_rsh_LDFLAGS =
+
+-mpirun_rsh_LDADD = @LIBCOMM@
++mpirun_rsh_LDADD = @COMMLOC@/@LIBCOMM@
+Index: config/x_ac_bootfabric.m4
+===================================================================
+--- config/x_ac_bootfabric.m4 (revision 481)
++++ config/x_ac_bootfabric.m4 (working copy)
+@@ -63,7 +63,7 @@
+ #AC_DEFINE(TOOL_SS_ENV, "LMON_SHARED_SECRET", [Define TOOL_SS_ENV])
+ #AC_DEFINE(TOOL_SCH_ENV, "LMON_SEC_CHK", [Define TOOL_SCH_ENV])
+ #AC_SUBST(COMMLOC, tools/pmgr_collective/src)
+- #AC_SUBST(LIBCOMM, -lpmgr_collective)
++ #AC_SUBST(LIBCOMM, libcobo.la)
+ #else
+ commfab_found="no"
+ AC_MSG_ERROR([--with-bootfabric=pmgr is given, but pmgr_collective has been deprecated])
+@@ -87,7 +87,7 @@
+ AC_DEFINE(TOOL_SS_ENV, "LMON_SHARED_SECRET", [Define TOOL_SS_ENV])
+ AC_DEFINE(TOOL_SCH_ENV, "LMON_SEC_CHK", [Define TOOL_SCH_ENV])
+ AC_SUBST(COMMLOC, tools/cobo/src)
+- AC_SUBST(LIBCOMM, -lcobo)
++ AC_SUBST(LIBCOMM, libcobo.la)
+
+ if test "x$with_cobo_port" != "xcheck" -a "x$with_cobo_port" != "xyes"; then
+ AC_DEFINE(COBO_BEGIN_PORT, $with_cobo_port, [Define a beginning port for COBO_BASED])
+@@ -117,7 +117,7 @@
+ AC_DEFINE(TOOL_SS_ENV, "LMON_SHARED_SECRET", [Define TOOL_SS_ENV])
+ AC_DEFINE(TOOL_SCH_ENV, "LMON_SEC_CHK", [Define TOOL_SCH_ENV])
+ AC_SUBST(COMMLOC, tools/cobo/src)
+- AC_SUBST(LIBCOMM, -lcobo)
++ AC_SUBST(LIBCOMM, libcobo.la)
+
+ if test "x$with_cobo_port" != "xcheck" -a "x$with_cobo_port" != "xyes"; then
+ AC_DEFINE(COBO_BEGIN_PORT, $with_cobo_port, [Define a beginning port for COBO_BASED])
+Index: config/x_ac_gcrpyt.m4
+===================================================================
+--- config/x_ac_gcrypt.m4 2011-10-22 00:50:38.000000000 -0700
++++ config/x_ac_gcrypt.patched.m4 2014-03-14 11:33:59.189220000 -0700
+@@ -55,8 +55,8 @@
+ AC_CONFIG_SUBDIRS([tools/libgpg-error])
+ AC_SUBST(GPGERRLOC, [tools/libgpg-error/src])
+ AC_SUBST(GCRYPTLOC, [tools/libgcrypt/src])
+- AC_SUBST(LIBGCRYPT, [-lgcrypt])
+- AC_SUBST(LIBGPGERR, [-lgpg-error])
++ AC_SUBST(LIBGCRYPT, [libgcrypt.la])
++ AC_SUBST(LIBGPGERR, [libgpg-error.la])
+ gcrypt_configured="yes"
+ else
+ AC_MSG_ERROR([tools/libgpg-error or tools/libgcrypt not found])
+
diff --git a/lib/spack/spack/packages/mrnet.py b/lib/spack/spack/packages/mrnet.py
new file mode 100644
index 0000000000..0fcbe68ee3
--- /dev/null
+++ b/lib/spack/spack/packages/mrnet.py
@@ -0,0 +1,14 @@
+from spack import *
+
+class Mrnet(Package):
+ """The MRNet Multi-Cast Reduction Network."""
+ homepage = "http://paradyn.org/mrnet"
+ url = "ftp://ftp.cs.wisc.edu/paradyn/mrnet/mrnet_4.0.0.tar.gz"
+
+ versions = { '4.0.0' : 'd00301c078cba57ef68613be32ceea2f', }
+
+ def install(self, spec, prefix):
+ configure("--prefix=%s" %prefix, "--enable-shared")
+
+ make(parallel=False)
+ make("install", parallel=False)
diff --git a/lib/spack/spack/packages/stat.py b/lib/spack/spack/packages/stat.py
new file mode 100644
index 0000000000..8d9d9f406a
--- /dev/null
+++ b/lib/spack/spack/packages/stat.py
@@ -0,0 +1,34 @@
+from spack import *
+
+class Stat(Package):
+ """Library to create, manipulate, and export graphs Graphlib."""
+ homepage = "http://paradyn.org/STAT/STAT.html"
+ url = "https://github.com/lee218llnl/stat/archive/v2.0.0.tar.gz"
+
+ versions = { '2.0.0' : 'c7494210b0ba26b577171b92838e1a9b', }
+
+ depends_on('libdwarf')
+ depends_on('dyninst')
+ depends_on('graphlib')
+ #depends_on('launchmon') # TODO: when added, path gets too long (Jira SPACK-21)!
+ depends_on('mrnet')
+
+ def install(self, spec, prefix):
+ my_mrnet = spec['mrnet']
+ my_graphlib = spec['graphlib']
+ #my_launchmon = spec['launchmon']
+ my_dyninst = spec['dyninst']
+ my_libdwarf = spec['libdwarf']
+
+ # TODO: this uses the launchmon package, but path is too long (see depends_on above) (Jira SPACK-21)
+ #configure("--enable-gui", "--prefix=%s" %prefix, "--with-launchmon=%s" %my_launchmon.prefix, "--with-mrnet=%s" %my_mrnet.prefix, "--with-graphlib=%s" %my_graphlib.prefix, "--with-stackwalker=%s" %my_dyninst.prefix, "--with-libdwarf=%s" %my_libdwarf.prefix)
+
+ # TODO: the configure line above is the proper one once Jira SPACK-21 is fixed
+ configure("--enable-gui", "--prefix=%s" %prefix, "--with-launchmon=/collab/usr/global/tools/launchmon/chaos_5_x86_64_ib/launchmon-1.0.0-20140312", "--with-mrnet=%s" %my_mrnet.prefix, "--with-graphlib=%s" %my_graphlib.prefix, "--with-stackwalker=%s" %my_dyninst.prefix, "--with-libdwarf=%s" %my_libdwarf.prefix)
+
+ # TODO: remove once Jira SPACK-19 is fixed
+ import shutil
+ shutil.copy2('/usr/bin/libtool', 'libtool')
+
+ make(parallel=False)
+ make("install")
diff --git a/lib/spack/spack/patch.py b/lib/spack/spack/patch.py
index 82a3a92449..2638000b27 100644
--- a/lib/spack/spack/patch.py
+++ b/lib/spack/spack/patch.py
@@ -24,14 +24,15 @@
##############################################################################
import os
+import llnl.util.tty as tty
+from llnl.util.filesystem import join_path
+
import spack
import spack.stage
import spack.error
import spack.packages as packages
-import spack.tty as tty
from spack.util.executable import which
-from spack.util.filesystem import new_path
# Patch tool for patching archives.
_patch = which("patch", required=True)
@@ -55,7 +56,7 @@ class Patch(object):
self.url = path_or_url
else:
pkg_dir = packages.dirname_for_package_name(pkg_name)
- self.path = new_path(pkg_dir, path_or_url)
+ self.path = join_path(pkg_dir, path_or_url)
if not os.path.isfile(self.path):
raise NoSuchPatchFileError(pkg_name, self.path)
diff --git a/lib/spack/spack/relations.py b/lib/spack/spack/relations.py
index 28c9bf0363..3950bd1a20 100644
--- a/lib/spack/spack/relations.py
+++ b/lib/spack/spack/relations.py
@@ -72,6 +72,8 @@ import re
import inspect
import importlib
+from llnl.util.lang import *
+
import spack
import spack.spec
import spack.error
@@ -79,7 +81,6 @@ import spack.error
from spack.patch import Patch
from spack.spec import Spec, parse_anonymous_spec
from spack.packages import packages_module
-from spack.util.lang import *
"""Adds a dependencies local variable in the locals of
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 8d84abcc20..a660e840d0 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -95,16 +95,17 @@ import itertools
import hashlib
from StringIO import StringIO
+import llnl.util.tty as tty
+from llnl.util.lang import *
+from llnl.util.tty.color import *
+
import spack.parse
import spack.error
import spack.compilers
import spack.compilers.gcc
import spack.packages as packages
-import spack.tty as tty
from spack.version import *
-from spack.color import *
-from spack.util.lang import *
from spack.util.string import *
from spack.util.prefix import Prefix
diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py
index 9777ca5d5a..fe99c0ad8a 100644
--- a/lib/spack/spack/stage.py
+++ b/lib/spack/spack/stage.py
@@ -27,11 +27,11 @@ import re
import shutil
import tempfile
+import llnl.util.tty as tty
+from llnl.util.filesystem import *
+
import spack
import spack.error as serr
-import spack.tty as tty
-
-from spack.util.filesystem import *
from spack.util.compression import decompressor_for
STAGE_PREFIX = 'spack-stage-'
@@ -88,7 +88,7 @@ class Stage(object):
def _cleanup_dead_links(self):
"""Remove any dead links in the stage directory."""
for file in os.listdir(spack.stage_path):
- path = new_path(spack.stage_path, file)
+ path = join_path(spack.stage_path, file)
if os.path.islink(path):
real_path = os.path.realpath(path)
if not os.path.exists(path):
@@ -150,7 +150,7 @@ class Stage(object):
# If this is a named stage, then construct a named path.
if self.name is not None:
- self.path = new_path(spack.stage_path, self.name)
+ self.path = join_path(spack.stage_path, self.name)
# If this is a temporary stage, them make the temp directory
tmp_dir = None
@@ -159,7 +159,7 @@ class Stage(object):
# Unnamed tmp root. Link the path in
tmp_dir = tempfile.mkdtemp('', STAGE_PREFIX, self.tmp_root)
self.name = os.path.basename(tmp_dir)
- self.path = new_path(spack.stage_path, self.name)
+ self.path = join_path(spack.stage_path, self.name)
if self._need_to_create_path():
os.symlink(tmp_dir, self.path)
@@ -200,7 +200,7 @@ class Stage(object):
return None
for file in os.listdir(self.path):
- archive_path = spack.new_path(self.path, file)
+ archive_path = join_path(self.path, file)
if os.path.isdir(archive_path):
return archive_path
return None
@@ -333,7 +333,7 @@ def purge():
"""Remove all build directories in the top-level stage path."""
if os.path.isdir(spack.stage_path):
for stage_dir in os.listdir(spack.stage_path):
- stage_path = spack.new_path(spack.stage_path, stage_dir)
+ stage_path = join_path(spack.stage_path, stage_dir)
remove_linked_tree(stage_path)
diff --git a/lib/spack/spack/test/__init__.py b/lib/spack/spack/test/__init__.py
index bf8dd6ea96..2aadf40382 100644
--- a/lib/spack/spack/test/__init__.py
+++ b/lib/spack/spack/test/__init__.py
@@ -25,9 +25,11 @@
import sys
import unittest
+import llnl.util.tty as tty
+from llnl.util.tty.colify import colify
+
import spack
-from spack.colify import colify
-import spack.tty as tty
+
"""Names of tests to be included in Spack's test suite"""
test_names = ['versions',
diff --git a/lib/spack/spack/test/mock_packages_test.py b/lib/spack/spack/test/mock_packages_test.py
index 441f4b7fbe..69bd120c58 100644
--- a/lib/spack/spack/test/mock_packages_test.py
+++ b/lib/spack/spack/test/mock_packages_test.py
@@ -24,12 +24,14 @@
##############################################################################
import unittest
+from llnl.util.lang import list_modules
+from llnl.util.filesystem import join_path
+
import spack
import spack.packages as packages
from spack.spec import Spec
-from spack.util.lang import new_path, list_modules
-mock_packages_path = new_path(spack.module_path, 'test', 'mock_packages')
+mock_packages_path = join_path(spack.module_path, 'test', 'mock_packages')
original_deps = None
diff --git a/lib/spack/spack/test/packages.py b/lib/spack/spack/test/packages.py
index 9541c54c13..1a1f9c9bf4 100644
--- a/lib/spack/spack/test/packages.py
+++ b/lib/spack/spack/test/packages.py
@@ -40,7 +40,7 @@ class PackagesTest(MockPackagesTest):
def test_regular_package_filename(self):
filename = packages.filename_for_package_name('mpich')
- self.assertEqual(filename, new_path(mock_packages_path, 'mpich.py'))
+ self.assertEqual(filename, join_path(mock_packages_path, 'mpich.py'))
def test_regular_package_name(self):
@@ -61,9 +61,9 @@ class PackagesTest(MockPackagesTest):
def test_directory_package_filename(self):
filename = packages.filename_for_package_name('directory-pkg')
- self.assertEqual(filename, new_path(mock_packages_path, 'directory-pkg/__init__.py'))
+ self.assertEqual(filename, join_path(mock_packages_path, 'directory-pkg/__init__.py'))
def test_nonexisting_package_filename(self):
filename = packages.filename_for_package_name('some-nonexisting-package')
- self.assertEqual(filename, new_path(mock_packages_path, 'some-nonexisting-package.py'))
+ self.assertEqual(filename, join_path(mock_packages_path, 'some-nonexisting-package.py'))
diff --git a/lib/spack/spack/test/spec_dag.py b/lib/spack/spack/test/spec_dag.py
index da0b878ce1..d03d146310 100644
--- a/lib/spack/spack/test/spec_dag.py
+++ b/lib/spack/spack/test/spec_dag.py
@@ -32,7 +32,8 @@ import spack
import spack.package
import spack.packages as packages
-from spack.util.lang import new_path, list_modules
+from llnl.util.lang import list_modules
+
from spack.spec import Spec
from spack.test.mock_packages_test import *
diff --git a/lib/spack/spack/test/stage.py b/lib/spack/spack/test/stage.py
index 102a692ca2..08899f9810 100644
--- a/lib/spack/spack/test/stage.py
+++ b/lib/spack/spack/test/stage.py
@@ -31,28 +31,32 @@ import os
import getpass
from contextlib import *
+from llnl.util.filesystem import *
+
import spack
from spack.stage import Stage
-from spack.util.filesystem import *
from spack.util.executable import which
-test_files_dir = new_path(spack.stage_path, '.test')
-test_tmp_path = new_path(test_files_dir, 'tmp')
+test_files_dir = join_path(spack.stage_path, '.test')
+test_tmp_path = join_path(test_files_dir, 'tmp')
archive_dir = 'test-files'
archive_name = archive_dir + '.tar.gz'
-archive_dir_path = new_path(test_files_dir, archive_dir)
-archive_url = 'file://' + new_path(test_files_dir, archive_name)
+archive_dir_path = join_path(test_files_dir, archive_dir)
+archive_url = 'file://' + join_path(test_files_dir, archive_name)
readme_name = 'README.txt'
-test_readme = new_path(archive_dir_path, readme_name)
+test_readme = join_path(archive_dir_path, readme_name)
readme_text = "hello world!\n"
stage_name = 'spack-test-stage'
class with_tmp(object):
- """Decorator that executes a function with or without spack set
- to use a temp dir."""
+ """Decorator that executes a function with or without spack set to use
+ a temp dir. Spack allows builds to happen directly in the
+ stage directory or in a tmp dir and symlinked into the stage
+ directory, so this lets us use the same test in both cases.
+ """
def __init__(self, use_tmp):
self.use_tmp = use_tmp
@@ -107,7 +111,7 @@ class StageTest(unittest.TestCase):
"""
if stage_name:
# If it is a named stage, we know where the stage should be
- stage_path = new_path(spack.stage_path, stage_name)
+ stage_path = join_path(spack.stage_path, stage_name)
else:
# If it's unnamed, ensure that we ran mkdtemp in the right spot.
stage_path = stage.path
@@ -143,7 +147,7 @@ class StageTest(unittest.TestCase):
def check_fetch(self, stage, stage_name):
stage_path = self.get_stage_path(stage, stage_name)
self.assertIn(archive_name, os.listdir(stage_path))
- self.assertEqual(new_path(stage_path, archive_name),
+ self.assertEqual(join_path(stage_path, archive_name),
stage.archive_file)
@@ -153,10 +157,10 @@ class StageTest(unittest.TestCase):
self.assertIn(archive_dir, os.listdir(stage_path))
self.assertEqual(
- new_path(stage_path, archive_dir),
+ join_path(stage_path, archive_dir),
stage.expanded_archive_path)
- readme = new_path(stage_path, archive_dir, readme_name)
+ readme = join_path(stage_path, archive_dir, readme_name)
self.assertTrue(os.path.isfile(readme))
with closing(open(readme)) as file:
@@ -171,7 +175,7 @@ class StageTest(unittest.TestCase):
def check_chdir_to_archive(self, stage, stage_name):
stage_path = self.get_stage_path(stage, stage_name)
self.assertEqual(
- new_path(os.path.realpath(stage_path), archive_dir),
+ join_path(os.path.realpath(stage_path), archive_dir),
os.getcwd())
diff --git a/lib/spack/spack/url.py b/lib/spack/spack/url.py
index a4c32eb37b..f56aaee493 100644
--- a/lib/spack/spack/url.py
+++ b/lib/spack/spack/url.py
@@ -48,7 +48,7 @@ import os
import re
import spack.error
-import spack.util.filesystem as fs
+import spack.util.compression as comp
from spack.version import Version
#
@@ -85,9 +85,9 @@ def parse_version_string_with_indices(path):
if os.path.isdir(path):
stem = os.path.basename(path)
elif re.search(r'((?:sourceforge.net|sf.net)/.*)/download$', path):
- stem = fs.stem(os.path.dirname(path))
+ stem = comp.stem(os.path.dirname(path))
else:
- stem = fs.stem(path)
+ stem = comp.stem(path)
version_types = [
# GitHub tarballs, e.g. v1.2.3
diff --git a/lib/spack/spack/util/compression.py b/lib/spack/spack/util/compression.py
index 2b8b05eb28..427a9cf020 100644
--- a/lib/spack/spack/util/compression.py
+++ b/lib/spack/spack/util/compression.py
@@ -22,6 +22,7 @@
# 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
from itertools import product
from spack.util.executable import which
@@ -45,3 +46,13 @@ def decompressor_for(path):
tar = which('tar', required=True)
tar.add_default_arg('-xf')
return tar
+
+
+def stem(path):
+ """Get the part of a path that does not include its compressed
+ type extension."""
+ for type in ALLOWED_ARCHIVE_TYPES:
+ suffix = r'\.%s$' % type
+ if re.search(suffix, path):
+ return re.sub(suffix, "", path)
+ return path
diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py
index 4d5eff0bd8..ac329445f7 100644
--- a/lib/spack/spack/util/executable.py
+++ b/lib/spack/spack/util/executable.py
@@ -27,7 +27,7 @@ import sys
import re
import subprocess
-import spack.tty as tty
+import llnl.util.tty as tty
from spack.error import SpackError
diff --git a/lib/spack/spack/util/prefix.py b/lib/spack/spack/util/prefix.py
index 09a04676f7..1b5ab5933f 100644
--- a/lib/spack/spack/util/prefix.py
+++ b/lib/spack/spack/util/prefix.py
@@ -25,7 +25,7 @@
"""
This file contains utilities to help with installing packages.
"""
-from spack.util.filesystem import new_path
+from llnl.util.filesystem import join_path
class Prefix(str):
"""This class represents an installation prefix, but provides useful
@@ -59,23 +59,23 @@ class Prefix(str):
def __new__(cls, path):
s = super(Prefix, cls).__new__(cls, path)
- s.bin = new_path(s, 'bin')
- s.sbin = new_path(s, 'sbin')
- s.etc = new_path(s, 'etc')
- s.include = new_path(s, 'include')
- s.lib = new_path(s, 'lib')
- s.lib64 = new_path(s, 'lib64')
- s.libexec = new_path(s, 'libexec')
- s.share = new_path(s, 'share')
- s.doc = new_path(s.share, 'doc')
- s.info = new_path(s.share, 'info')
- s.man = new_path(s.share, 'man')
- s.man1 = new_path(s.man, 'man1')
- s.man2 = new_path(s.man, 'man2')
- s.man3 = new_path(s.man, 'man3')
- s.man4 = new_path(s.man, 'man4')
- s.man5 = new_path(s.man, 'man5')
- s.man6 = new_path(s.man, 'man6')
- s.man7 = new_path(s.man, 'man7')
- s.man8 = new_path(s.man, 'man8')
+ s.bin = join_path(s, 'bin')
+ s.sbin = join_path(s, 'sbin')
+ s.etc = join_path(s, 'etc')
+ s.include = join_path(s, 'include')
+ s.lib = join_path(s, 'lib')
+ s.lib64 = join_path(s, 'lib64')
+ s.libexec = join_path(s, 'libexec')
+ s.share = join_path(s, 'share')
+ s.doc = join_path(s.share, 'doc')
+ s.info = join_path(s.share, 'info')
+ s.man = join_path(s.share, 'man')
+ s.man1 = join_path(s.man, 'man1')
+ s.man2 = join_path(s.man, 'man2')
+ s.man3 = join_path(s.man, 'man3')
+ s.man4 = join_path(s.man, 'man4')
+ s.man5 = join_path(s.man, 'man5')
+ s.man6 = join_path(s.man, 'man6')
+ s.man7 = join_path(s.man, 'man7')
+ s.man8 = join_path(s.man, 'man8')
return s
diff --git a/lib/spack/spack/util/web.py b/lib/spack/spack/util/web.py
index 62c4fa6aa1..b5104eb076 100644
--- a/lib/spack/spack/util/web.py
+++ b/lib/spack/spack/util/web.py
@@ -29,9 +29,10 @@ import urlparse
from multiprocessing import Pool
from HTMLParser import HTMLParser
+import llnl.util.tty as tty
+
import spack
import spack.error
-import spack.tty as tty
from spack.util.compression import ALLOWED_ARCHIVE_TYPES
# Timeout in seconds for web requests
diff --git a/lib/spack/spack/version.py b/lib/spack/spack/version.py
index 8108c0f60b..1f44c5f39b 100644
--- a/lib/spack/spack/version.py
+++ b/lib/spack/spack/version.py
@@ -49,8 +49,8 @@ import re
from bisect import bisect_left
from functools import total_ordering, wraps
-import spack.util.none_high as none_high
-import spack.util.none_low as none_low
+import llnl.util.compare.none_high as none_high
+import llnl.util.compare.none_low as none_low
import spack.error
# Valid version characters