summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/spack/external/pyqver2.py12
-rw-r--r--lib/spack/spack/build_environment.py8
-rw-r--r--lib/spack/spack/cmd/find.py2
-rw-r--r--lib/spack/spack/test/python_version.py17
-rw-r--r--lib/spack/spack/util/executable.py27
-rw-r--r--var/spack/packages/bear/package.py17
-rw-r--r--var/spack/packages/mpfr/package.py2
7 files changed, 64 insertions, 21 deletions
diff --git a/lib/spack/external/pyqver2.py b/lib/spack/external/pyqver2.py
index cd45bf948f..4a16e2811e 100755
--- a/lib/spack/external/pyqver2.py
+++ b/lib/spack/external/pyqver2.py
@@ -165,12 +165,24 @@ class NodeChecker(object):
def rollup(n):
if isinstance(n, compiler.ast.Name):
return n.name
+ elif isinstance(n, compiler.ast.Const):
+ return type(n.value).__name__
elif isinstance(n, compiler.ast.Getattr):
r = rollup(n.expr)
if r:
return r + "." + n.attrname
name = rollup(node.node)
if name:
+ # Special handling for empty format strings, which aren't
+ # allowed in Python 2.6
+ if name in ('unicode.format', 'str.format'):
+ n = node.node
+ if isinstance(n, compiler.ast.Getattr):
+ n = n.expr
+ if isinstance(n, compiler.ast.Const):
+ if '{}' in n.value:
+ self.add(node, (2,7), name + ' with {} format string')
+
v = Functions.get(name)
if v is not None:
self.add(node, v, name)
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 81fbedc689..a133faa629 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -88,10 +88,10 @@ def set_compiler_environment_variables(pkg):
compiler = pkg.compiler
# Set compiler variables used by CMake and autotools
- os.environ['CC'] = 'cc'
- os.environ['CXX'] = 'c++'
- os.environ['F77'] = 'f77'
- os.environ['FC'] = 'f90'
+ os.environ['CC'] = join_path(spack.build_env_path, 'cc')
+ os.environ['CXX'] = join_path(spack.build_env_path, 'c++')
+ os.environ['F77'] = join_path(spack.build_env_path, 'f77')
+ os.environ['FC'] = join_path(spack.build_env_path, 'f90')
# Set SPACK compiler variables so that our wrapper knows what to call
if compiler.cc:
diff --git a/lib/spack/spack/cmd/find.py b/lib/spack/spack/cmd/find.py
index a0232d2f12..3c993990b1 100644
--- a/lib/spack/spack/cmd/find.py
+++ b/lib/spack/spack/cmd/find.py
@@ -92,7 +92,7 @@ def display_specs(specs, **kwargs):
# Print one spec per line along with prefix path
width = max(len(s) for s in abbreviated)
width += 2
- format = " %-{}s%s".format(width)
+ format = " %%-%ds%%s" % width
for abbrv, spec in zip(abbreviated, specs):
if hashes:
diff --git a/lib/spack/spack/test/python_version.py b/lib/spack/spack/test/python_version.py
index 5b803b4cf3..5779d31ed2 100644
--- a/lib/spack/spack/test/python_version.py
+++ b/lib/spack/spack/test/python_version.py
@@ -41,13 +41,10 @@ spack_max_version = (2,6)
class PythonVersionTest(unittest.TestCase):
- def spack_python_files(self):
+ def pyfiles(self, *search_paths):
# first file is the spack script.
yield spack.spack_file
- # Next files are all the source files and package files.
- search_paths = [spack.lib_path, spack.var_path]
-
# Iterate through the whole spack source tree.
for path in search_paths:
for root, dirnames, filenames in os.walk(path):
@@ -56,16 +53,20 @@ class PythonVersionTest(unittest.TestCase):
yield os.path.join(root, filename)
- def all_package_py_files(self):
+ def package_py_files(self):
for name in spack.db.all_package_names():
yield spack.db.filename_for_package_name(name)
- def check_python_versions(self, files):
+ def check_python_versions(self, *files):
# dict version -> filename -> reasons
all_issues = {}
for fn in files:
+ if fn != '/Users/gamblin2/src/spack/var/spack/packages/vim/package.py':
+ continue
+ print fn
+
with open(fn) as pyfile:
versions = pyqver2.get_versions(pyfile.read())
for ver, reasons in versions.items():
@@ -101,8 +102,8 @@ class PythonVersionTest(unittest.TestCase):
def test_core_module_compatibility(self):
- self.check_python_versions(self.spack_python_files())
+ self.check_python_versions(*self.pyfiles(spack.lib_path))
def test_package_module_compatibility(self):
- self.check_python_versions(self.all_package_py_files())
+ self.check_python_versions(*self.pyfiles(spack.packages_path))
diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py
index 67e8cddd98..d1dfb62ffb 100644
--- a/lib/spack/spack/util/executable.py
+++ b/lib/spack/spack/util/executable.py
@@ -34,6 +34,7 @@ import llnl.util.tty as tty
import spack
import spack.error
+
class Executable(object):
"""Class representing a program that can be run on the command line."""
def __init__(self, name):
@@ -58,7 +59,20 @@ class Executable(object):
return_output = kwargs.get("return_output", False)
fail_on_error = kwargs.get("fail_on_error", True)
ignore_errors = kwargs.get("ignore_errors", ())
+
+ output = kwargs.get("output", sys.stdout)
error = kwargs.get("error", sys.stderr)
+ input = kwargs.get("input", None)
+
+ def streamify(arg, mode):
+ if isinstance(arg, basestring):
+ return open(arg, mode), True
+ elif arg is None and mode != 'r':
+ return open(os.devnull, mode), True
+ return arg, False
+ output, ostream = streamify(output, 'w')
+ error, estream = streamify(error, 'w')
+ input, istream = streamify(input, 'r')
# if they just want to ignore one error code, make it a tuple.
if isinstance(ignore_errors, int):
@@ -77,16 +91,12 @@ class Executable(object):
cmd_line = ' '.join(cmd)
tty.debug(cmd_line)
- close_error = False
try:
- if error is None:
- error = open(os.devnull, 'w')
- close_error = True
-
proc = subprocess.Popen(
cmd,
+ stdin=input,
stderr=error,
- stdout=subprocess.PIPE if return_output else sys.stdout)
+ stdout=subprocess.PIPE if return_output else output)
out, err = proc.communicate()
self.returncode = proc.returncode
@@ -110,8 +120,9 @@ class Executable(object):
% (proc.returncode, cmd_line))
finally:
- if close_error:
- error.close()
+ if ostream: output.close()
+ if estream: error.close()
+ if istream: input.close()
def __eq__(self, other):
diff --git a/var/spack/packages/bear/package.py b/var/spack/packages/bear/package.py
new file mode 100644
index 0000000000..0d4436fccc
--- /dev/null
+++ b/var/spack/packages/bear/package.py
@@ -0,0 +1,17 @@
+from spack import *
+
+class Bear(Package):
+ """Bear is a tool that generates a compilation database for clang tooling from non-cmake build systems."""
+ homepage = "https://github.com/rizsotto/Bear"
+ url = "https://github.com/rizsotto/Bear/archive/2.0.4.tar.gz"
+
+ version('2.0.4', 'fd8afb5e8e18f8737ba06f90bd77d011')
+
+ depends_on("cmake")
+ depends_on("python")
+
+ def install(self, spec, prefix):
+ cmake('.', *std_cmake_args)
+
+ make("all")
+ make("install")
diff --git a/var/spack/packages/mpfr/package.py b/var/spack/packages/mpfr/package.py
index 3cd8ec41e4..9c744a22df 100644
--- a/var/spack/packages/mpfr/package.py
+++ b/var/spack/packages/mpfr/package.py
@@ -33,6 +33,8 @@ class Mpfr(Package):
version('3.1.3', '5fdfa3cfa5c86514ee4a241a1affa138')
# version('3.1.2', 'ee2c3ac63bf0c2359bf08fc3ee094c19')
+ depends_on('gmp')
+
def install(self, spec, prefix):
configure("--prefix=%s" % prefix)
make()