Allow Spack to uninstall external extensions without permissions (#11991)
* Allow Spack to uninstall external extensions without permissions Raise when self.projections is not empty
This commit is contained in:
parent
0b4e13c034
commit
44f4ad7bbf
@ -201,9 +201,13 @@ def __init__(self, root, layout, **kwargs):
|
|||||||
# Write projections file to new view
|
# Write projections file to new view
|
||||||
# Not strictly necessary as the empty file is the empty
|
# Not strictly necessary as the empty file is the empty
|
||||||
# projection but it makes sense for consistency
|
# projection but it makes sense for consistency
|
||||||
mkdirp(os.path.dirname(projections_path))
|
try:
|
||||||
with open(projections_path, 'w') as f:
|
mkdirp(os.path.dirname(projections_path))
|
||||||
f.write(s_yaml.dump({'projections': self.projections}))
|
with open(projections_path, 'w') as f:
|
||||||
|
f.write(s_yaml.dump({'projections': self.projections}))
|
||||||
|
except OSError as e:
|
||||||
|
if self.projections:
|
||||||
|
raise e
|
||||||
elif not os.path.exists(projections_path):
|
elif not os.path.exists(projections_path):
|
||||||
# Write projections file to new view
|
# Write projections file to new view
|
||||||
mkdirp(os.path.dirname(projections_path))
|
mkdirp(os.path.dirname(projections_path))
|
||||||
|
Loading…
Reference in New Issue
Block a user