Minor cleanup and bug fixes.
This commit is contained in:
parent
c8414a8a40
commit
4608b674e5
7 changed files with 26 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
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"
|
||||
|
||||
|
|
|
@ -51,6 +51,15 @@ def concretize_version(self, spec):
|
|||
"""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 @@ def concretize_compiler(self, spec):
|
|||
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
|
||||
|
|
|
@ -654,8 +654,9 @@ def do_install(self, **kwargs):
|
|||
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 @@ def do_install(self, **kwargs):
|
|||
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)
|
||||
|
|
|
@ -145,7 +145,7 @@ def _setup(self):
|
|||
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.
|
||||
|
|
|
@ -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 @@ def test_install_and_uninstall(self):
|
|||
# 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 @@ def test_install_and_uninstall(self):
|
|||
pkg.do_install()
|
||||
pkg.do_uninstall()
|
||||
except Exception, e:
|
||||
if pkg: pkg.remove_prefix()
|
||||
pkg.remove_prefix()
|
||||
raise
|
||||
|
|
|
@ -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 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):
|
||||
|
|
Loading…
Reference in a new issue