env: rename EnvError to SpackEnvironmentError
This commit is contained in:
parent
13aca774e3
commit
62f8ea1a75
@ -168,7 +168,7 @@ def do_uninstall(specs, force):
|
|||||||
if ev.active:
|
if ev.active:
|
||||||
try:
|
try:
|
||||||
ev.active.remove(item, force=True)
|
ev.active.remove(item, force=True)
|
||||||
except ev.EnvError:
|
except ev.SpackEnvironmentError:
|
||||||
pass # ignore errors from specs that are not roots
|
pass # ignore errors from specs that are not roots
|
||||||
|
|
||||||
# Sort packages to be uninstalled by the number of installed dependents
|
# Sort packages to be uninstalled by the number of installed dependents
|
||||||
|
@ -195,7 +195,7 @@ def disambiguate(env, env_dir=None):
|
|||||||
if is_env_dir(env_dir):
|
if is_env_dir(env_dir):
|
||||||
return Environment(env_dir)
|
return Environment(env_dir)
|
||||||
else:
|
else:
|
||||||
raise EnvError('no environment in %s' % env_dir)
|
raise SpackEnvironmentError('no environment in %s' % env_dir)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ def read(name):
|
|||||||
"""Get an environment with the supplied name."""
|
"""Get an environment with the supplied name."""
|
||||||
validate_env_name(name)
|
validate_env_name(name)
|
||||||
if not exists(name):
|
if not exists(name):
|
||||||
raise EnvError("no such environment '%s'" % name)
|
raise SpackEnvironmentError("no such environment '%s'" % name)
|
||||||
return Environment(root(name))
|
return Environment(root(name))
|
||||||
|
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ def create(name, init_file=None):
|
|||||||
"""Create a named environment in Spack."""
|
"""Create a named environment in Spack."""
|
||||||
validate_env_name(name)
|
validate_env_name(name)
|
||||||
if exists(name):
|
if exists(name):
|
||||||
raise EnvError("'%s': environment already exists" % name)
|
raise SpackEnvironmentError("'%s': environment already exists" % name)
|
||||||
return Environment(root(name), init_file)
|
return Environment(root(name), init_file)
|
||||||
|
|
||||||
|
|
||||||
@ -472,9 +472,10 @@ def add(self, user_spec):
|
|||||||
"""
|
"""
|
||||||
spec = Spec(user_spec)
|
spec = Spec(user_spec)
|
||||||
if not spec.name:
|
if not spec.name:
|
||||||
raise EnvError('cannot add anonymous specs to an environment!')
|
raise SpackEnvironmentError(
|
||||||
|
'cannot add anonymous specs to an environment!')
|
||||||
elif not spack.repo.path.exists(spec.name):
|
elif not spack.repo.path.exists(spec.name):
|
||||||
raise EnvError('no such package: %s' % spec.name)
|
raise SpackEnvironmentError('no such package: %s' % spec.name)
|
||||||
|
|
||||||
existing = set(s for s in self.user_specs if s.name == spec.name)
|
existing = set(s for s in self.user_specs if s.name == spec.name)
|
||||||
if not existing:
|
if not existing:
|
||||||
@ -498,7 +499,7 @@ def remove(self, query_spec, force=False):
|
|||||||
s for s, h in specs_hashes if query_spec.dag_hash() == h]
|
s for s, h in specs_hashes if query_spec.dag_hash() == h]
|
||||||
|
|
||||||
if not matches:
|
if not matches:
|
||||||
raise EnvError("Not found: {0}".format(query_spec))
|
raise SpackEnvironmentError("Not found: {0}".format(query_spec))
|
||||||
|
|
||||||
for spec in matches:
|
for spec in matches:
|
||||||
if spec in self.user_specs:
|
if spec in self.user_specs:
|
||||||
@ -860,9 +861,5 @@ def deactivate_config_scope(env):
|
|||||||
spack.config.config.remove_scope(scope.name)
|
spack.config.config.remove_scope(scope.name)
|
||||||
|
|
||||||
|
|
||||||
class EnvError(spack.error.SpackError):
|
class SpackEnvironmentError(spack.error.SpackError):
|
||||||
"""Superclass for all errors to do with Spack environments.
|
"""Superclass for all errors to do with Spack environments."""
|
||||||
|
|
||||||
Note that this is called ``EnvError`` to distinguish it from the
|
|
||||||
builtin ``EnvironmentError``.
|
|
||||||
"""
|
|
||||||
|
Loading…
Reference in New Issue
Block a user