Move packages and mock packages to /var/spack

This commit is contained in:
Todd Gamblin 2014-03-16 16:03:49 -07:00
parent 566dc037e7
commit 81dc27bf41
39 changed files with 18 additions and 17 deletions

View file

@ -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:

View file

@ -53,8 +53,13 @@
#
# Set up the packages database.
#
db = PackageDB(join_path(module_path, "packages"))
packages_path = join_path(var_path, "packages")
db = PackageDB(packages_path)
#
# This is the path to mock packages used by spack for testing.
#
mock_packages_path = join_path(var_path, "mock_packages")
#
# This controls how spack lays out install prefixes and

View file

@ -200,10 +200,6 @@ def get_class_for_package_name(self, pkg_name):
else:
raise UnknownPackageError(pkg_name)
# Figure out pacakges module based on self.root
if not re.match(r'%s' % spack.module_path, self.root):
raise RuntimeError("Packages path is not a submodule of spack.")
class_name = class_name_for_package_name(pkg_name)
try:
module_name = _imported_packages_module + '.' + pkg_name

View file

@ -24,15 +24,10 @@
##############################################################################
import unittest
from llnl.util.lang import list_modules
from llnl.util.filesystem import join_path
import spack
from spack.packages import PackageDB
from spack.spec import Spec
mock_packages_path = join_path(spack.module_path, 'test', 'mock_packages')
def set_pkg_dep(pkg, spec):
"""Alters dependence information for a pacakge.
Use this to mock up constraints.
@ -48,7 +43,7 @@ def setUp(self):
# us to set up contrived packages that don't interfere with
# real ones.
self.real_db = spack.db
spack.db = PackageDB(mock_packages_path)
spack.db = PackageDB(spack.mock_packages_path)
@classmethod

View file

@ -24,9 +24,10 @@
##############################################################################
import unittest
from llnl.util.filesystem import join_path
import spack
import spack.packages as packages
from spack.test.mock_packages_test import *
@ -43,7 +44,7 @@ def test_package_name(self):
def test_package_filename(self):
filename = spack.db.filename_for_package_name('mpich')
self.assertEqual(filename, join_path(mock_packages_path, 'mpich', 'package.py'))
self.assertEqual(filename, join_path(spack.mock_packages_path, 'mpich', 'package.py'))
def test_package_name(self):
@ -53,7 +54,7 @@ def test_package_name(self):
def test_nonexisting_package_filename(self):
filename = spack.db.filename_for_package_name('some-nonexisting-package')
self.assertEqual(filename, join_path(mock_packages_path, 'some-nonexisting-package', 'package.py'))
self.assertEqual(filename, join_path(spack.mock_packages_path, 'some-nonexisting-package', 'package.py'))
def test_package_class_names(self):