summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-10-12 18:25:18 -0700
committerGitHub <noreply@github.com>2016-10-12 18:25:18 -0700
commitd861a52ebec2a73451fde5870b92b2ff4fb81620 (patch)
tree0031c36bb4a4e7a7bd8ddda570cf8884ce4a07ac /bin
parentb27f4e3aebf6c1ecbefffc22a9a27a4fe9ce0ab3 (diff)
downloadspack-d861a52ebec2a73451fde5870b92b2ff4fb81620.tar.gz
spack-d861a52ebec2a73451fde5870b92b2ff4fb81620.tar.bz2
spack-d861a52ebec2a73451fde5870b92b2ff4fb81620.tar.xz
spack-d861a52ebec2a73451fde5870b92b2ff4fb81620.zip
Use cYAML if it is available in Python. (#2010)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/spack10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/spack b/bin/spack
index 503ef068bf..29991c070d 100755
--- a/bin/spack
+++ b/bin/spack
@@ -40,6 +40,16 @@ SPACK_PREFIX = os.path.dirname(os.path.dirname(SPACK_FILE))
# Allow spack libs to be imported in our scripts
SPACK_LIB_PATH = os.path.join(SPACK_PREFIX, "lib", "spack")
sys.path.insert(0, SPACK_LIB_PATH)
+
+# Try to use system YAML if it is available, as it might have libyaml
+# support (for faster loading via C). Load it before anything in
+# lib/spack/external so it will take precedence over Spack's PyYAML.
+try:
+ import yaml
+except ImportError:
+ pass # ignore and use slow yaml
+
+# Add external libs
SPACK_EXTERNAL_LIBS = os.path.join(SPACK_LIB_PATH, "external")
sys.path.insert(0, SPACK_EXTERNAL_LIBS)