summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/spack10
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/spack b/bin/spack
index 60a2ef4c3a..b922fc5479 100755
--- a/bin/spack
+++ b/bin/spack
@@ -39,6 +39,12 @@ SPACK_PREFIX = os.path.dirname(os.path.dirname(SPACK_FILE))
SPACK_LIB_PATH = os.path.join(SPACK_PREFIX, "lib", "spack")
sys.path.insert(0, SPACK_LIB_PATH)
+# If there is no working directory, use the spack prefix.
+try:
+ os.getcwd()
+except OSError:
+ os.chdir(SPACK_PREFIX)
+
# clean up the scope and start using spack package instead.
del SPACK_FILE, SPACK_PREFIX, SPACK_LIB_PATH
import llnl.util.tty as tty
@@ -74,10 +80,8 @@ args = parser.parse_args()
spack.verbose = args.verbose
spack.debug = args.debug
if args.mock:
- from llnl.util.filesystem import join_path
from spack.packages import PackageDB
- mock_path = join_path(spack.module_path, 'test', 'mock_packages')
- spack.db = PackageDB(mock_path)
+ spack.db = PackageDB(spack.mock_packages_path)
# If the user asked for it, don't check ssl certs.
if args.insecure: