diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/package.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/packages.py | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 3e253286e8..361fda1ba6 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -494,7 +494,7 @@ class Package(object): on this one.""" dependents = [] for spec in spack.db.installed_package_specs(): - if self.spec != spec and self.spec in spec: + if self.name != spec.name and self.spec in spec: dependents.append(spec) return dependents diff --git a/lib/spack/spack/packages.py b/lib/spack/spack/packages.py index fd75d8e326..72f9403a64 100644 --- a/lib/spack/spack/packages.py +++ b/lib/spack/spack/packages.py @@ -69,7 +69,10 @@ class PackageDB(object): if not spec in self.instances: package_class = self.get_class_for_package_name(spec.name) - self.instances[spec.copy()] = package_class(spec) + try: + self.instances[spec.copy()] = package_class(spec) + except Exception, e: + raise FailedConstructorError(spec.name, e) return self.instances[spec] @@ -232,3 +235,12 @@ class UnknownPackageError(spack.error.SpackError): def __init__(self, name): super(UnknownPackageError, self).__init__("Package %s not found." % name) self.name = name + + +class FailedConstructorError(spack.error.SpackError): + """Raised when a package's class constructor fails.""" + def __init__(self, name, reason): + super(FailedConstructorError, self).__init__( + "Class constructor failed for package '%s'." % name, + str(reason)) + self.name = name |