summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-06-17 19:26:45 -0500
committerTodd Gamblin <tgamblin@llnl.gov>2014-06-22 12:50:34 -0700
commit4608b674e512595f934fe942187847abae950bb4 (patch)
treeefc6e3909cfe65a1925fe498f40e45834150f596 /lib
parentc8414a8a40d73e7c93b3a0f3d84d5141246f518c (diff)
downloadspack-4608b674e512595f934fe942187847abae950bb4.tar.gz
spack-4608b674e512595f934fe942187847abae950bb4.tar.bz2
spack-4608b674e512595f934fe942187847abae950bb4.tar.xz
spack-4608b674e512595f934fe942187847abae950bb4.zip
Minor cleanup and bug fixes.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/llnl/util/filesystem.py3
-rw-r--r--lib/spack/spack/cmd/bootstrap.py2
-rw-r--r--lib/spack/spack/concretize.py18
-rw-r--r--lib/spack/spack/package.py12
-rw-r--r--lib/spack/spack/stage.py2
-rw-r--r--lib/spack/spack/test/install.py6
-rw-r--r--lib/spack/spack/util/executable.py3
7 files changed, 26 insertions, 20 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py
index 2ec8c61cfa..80341f3ddc 100644
--- a/lib/spack/llnl/util/filesystem.py
+++ b/lib/spack/llnl/util/filesystem.py
@@ -22,6 +22,9 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
+__all__ = ['install', 'expand_user', 'working_dir', 'touch', 'mkdirp',
+ 'join_path', 'ancestor', 'can_access']
+
import os
import re
import shutil
diff --git a/lib/spack/spack/cmd/bootstrap.py b/lib/spack/spack/cmd/bootstrap.py
index 11fc67e519..31c908d42b 100644
--- a/lib/spack/spack/cmd/bootstrap.py
+++ b/lib/spack/spack/cmd/bootstrap.py
@@ -26,9 +26,9 @@ import os
from subprocess import check_call, check_output
import llnl.util.tty as tty
+from llnl.util.filesystem import join_path
import spack
-from spack import join_path
description = "Create a new installation of spack in another prefix"
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index 312b9ce1b1..d4c7c25dca 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -51,6 +51,15 @@ class DefaultConcretizer(object):
"""If the spec is already concrete, return. Otherwise take
the most recent available version, and default to the package's
version if there are no avaialble versions.
+
+ TODO: In many cases we probably want to look for installed
+ versions of each package and use an installed version
+ if we can link to it. The policy implemented here will
+ tend to rebuild a lot of stuff becasue it will prefer
+ a compiler in the spec to any compiler already-
+ installed things were built with. There is likely
+ some better policy that finds some middle ground
+ between these two extremes.
"""
# return if already concrete.
if spec.versions.concrete:
@@ -100,15 +109,6 @@ class DefaultConcretizer(object):
this one has a strict compiler requirement. Otherwise, try to
build with the compiler that will be used by libraries that
link to this one, to maximize compatibility.
-
- TODO: In many cases we probably want to look for installed
- versions of each package and use *that* version if we
- can link to it. The policy implemented here will
- tend to rebuild a lot of stuff becasue it will prefer
- a compiler in the spec to any compiler already-
- installed things were built with. There is likely
- some better policy that finds some middle ground
- between these two extremes.
"""
if spec.compiler and spec.compiler.concrete:
return
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index fff471599a..ef8b639adf 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -654,8 +654,9 @@ class Package(object):
try:
tty.msg("Building %s." % self.name)
- # create the install directory (allow the layout to handle
- # this in case it needs to add extra files)
+ # create the install directory. The install layout
+ # handles this in case so that it can use whatever
+ # package naming scheme it likes.
spack.install_layout.make_path_for_spec(self.spec)
# Set up process's build environment before running install.
@@ -663,18 +664,17 @@ class Package(object):
build_env.set_build_environment_variables(self)
build_env.set_module_variables_for_package(self)
- # Subclasses implement install() to do the build &
- # install work.
+ # Subclasses implement install() to do the real work.
self.install(self.spec, self.prefix)
+ # Ensure that something was actually installed.
if not os.listdir(self.prefix):
raise InstallError(
"Install failed for %s. Nothing was installed!"
% self.name)
+ # On successful install, remove the stage.
if not keep_stage:
- # On successful install, remove the stage.
- # Leave it if there is an error
self.stage.destroy()
tty.msg("Successfully installed %s" % self.name)
diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py
index df2fe83dac..8574df71e9 100644
--- a/lib/spack/spack/stage.py
+++ b/lib/spack/spack/stage.py
@@ -145,7 +145,7 @@ class Stage(object):
back to making the stage inside spack.stage_path.
"""
# Create the top-level stage directory
- spack.mkdirp(spack.stage_path)
+ mkdirp(spack.stage_path)
self._cleanup_dead_links()
# If this is a named stage, then construct a named path.
diff --git a/lib/spack/spack/test/install.py b/lib/spack/spack/test/install.py
index ac3753c948..a92bd92289 100644
--- a/lib/spack/spack/test/install.py
+++ b/lib/spack/spack/test/install.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 os
import unittest
import shutil
from contextlib import closing
@@ -82,11 +83,12 @@ class InstallTest(MockPackagesTest):
# Get a basic concrete spec for the trivial install package.
spec = Spec(install_test_package)
spec.concretize()
+ self.assertTrue(spec.concrete)
# Get the package
pkg = spack.db.get(spec)
- # Fake some values
+ # Fake the URL for the package so it downloads from a file.
archive_path = join_path(self.stage.path, archive_name)
pkg.url = 'file://' + archive_path
@@ -94,5 +96,5 @@ class InstallTest(MockPackagesTest):
pkg.do_install()
pkg.do_uninstall()
except Exception, e:
- if pkg: pkg.remove_prefix()
+ pkg.remove_prefix()
raise
diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py
index 6dea46a5c8..d65f7ed922 100644
--- a/lib/spack/spack/util/executable.py
+++ b/lib/spack/spack/util/executable.py
@@ -22,6 +22,8 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
+__all__ = ['Executable', 'when']
+
import os
import sys
import re
@@ -30,7 +32,6 @@ import subprocess
import llnl.util.tty as tty
from spack.error import SpackError
-
class Executable(object):
"""Class representing a program that can be run on the command line."""
def __init__(self, name):