2013-06-02 20:54:46 +00:00
|
|
|
#!/usr/bin/env python
|
2014-01-08 09:21:02 +00:00
|
|
|
#
|
2019-01-01 06:04:23 +00:00
|
|
|
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
|
2018-10-07 20:52:23 +00:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
2014-01-08 09:21:02 +00:00
|
|
|
#
|
2018-10-07 20:52:23 +00:00
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
|
2017-03-07 22:25:48 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2017-05-08 20:18:29 +00:00
|
|
|
import os
|
2013-06-02 20:54:46 +00:00
|
|
|
import sys
|
2017-05-08 20:18:29 +00:00
|
|
|
|
2017-03-07 17:31:15 +00:00
|
|
|
if sys.version_info[:2] < (2, 6):
|
2014-12-19 19:09:37 +00:00
|
|
|
v_info = sys.version_info[:3]
|
2017-03-07 17:31:15 +00:00
|
|
|
sys.exit("Spack requires Python 2.6 or higher."
|
2016-08-09 20:23:53 +00:00
|
|
|
"This is Python %d.%d.%d." % v_info)
|
2013-02-14 01:50:44 +00:00
|
|
|
|
|
|
|
# Find spack's location and its prefix.
|
2017-05-08 20:18:29 +00:00
|
|
|
spack_file = os.path.realpath(os.path.expanduser(__file__))
|
|
|
|
spack_prefix = os.path.dirname(os.path.dirname(spack_file))
|
2013-02-14 01:50:44 +00:00
|
|
|
|
|
|
|
# Allow spack libs to be imported in our scripts
|
2017-05-08 20:18:29 +00:00
|
|
|
spack_lib_path = os.path.join(spack_prefix, "lib", "spack")
|
|
|
|
sys.path.insert(0, spack_lib_path)
|
2016-10-13 01:25:18 +00:00
|
|
|
|
|
|
|
# Add external libs
|
2017-05-08 20:18:29 +00:00
|
|
|
spack_external_libs = os.path.join(spack_lib_path, "external")
|
2018-01-16 06:00:39 +00:00
|
|
|
|
|
|
|
if sys.version_info[:2] == (2, 6):
|
|
|
|
sys.path.insert(0, os.path.join(spack_external_libs, 'py26'))
|
|
|
|
|
2017-05-08 20:18:29 +00:00
|
|
|
sys.path.insert(0, spack_external_libs)
|
2013-02-14 01:50:44 +00:00
|
|
|
|
2018-11-07 00:06:18 +00:00
|
|
|
# Here we delete ruamel.yaml in case it has been already imported from site
|
|
|
|
# (see #9206 for a broader description of the issue).
|
|
|
|
#
|
|
|
|
# Briefly: ruamel.yaml produces a .pth file when installed with pip that
|
|
|
|
# makes the site installed package the preferred one, even tough sys.path
|
|
|
|
# is modified to point to another version of ruamel.yaml.
|
|
|
|
if 'ruamel.yaml' in sys.modules:
|
|
|
|
del sys.modules['ruamel.yaml']
|
|
|
|
|
|
|
|
if 'ruamel' in sys.modules:
|
|
|
|
del sys.modules['ruamel']
|
|
|
|
|
2017-05-08 20:18:29 +00:00
|
|
|
# Once we've set up the system path, run the spack main method
|
|
|
|
import spack.main # noqa
|
|
|
|
sys.exit(spack.main.main())
|