summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2019-08-08 19:46:14 -0500
committerGreg Becker <becker33@llnl.gov>2019-08-08 17:46:14 -0700
commit44f4ad7bbfcfb7da53a07fcd0f897db7ebf32448 (patch)
treeefae12ef92012c01f28ff8b9cd5cd44759a75abb /lib
parent0b4e13c0343313a6e26abb49f7db38e6b5cf1343 (diff)
downloadspack-44f4ad7bbfcfb7da53a07fcd0f897db7ebf32448.tar.gz
spack-44f4ad7bbfcfb7da53a07fcd0f897db7ebf32448.tar.bz2
spack-44f4ad7bbfcfb7da53a07fcd0f897db7ebf32448.tar.xz
spack-44f4ad7bbfcfb7da53a07fcd0f897db7ebf32448.zip
Allow Spack to uninstall external extensions without permissions (#11991)
* Allow Spack to uninstall external extensions without permissions Raise when self.projections is not empty
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/filesystem_view.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/spack/spack/filesystem_view.py b/lib/spack/spack/filesystem_view.py
index 1b3c692958..5385ca0803 100644
--- a/lib/spack/spack/filesystem_view.py
+++ b/lib/spack/spack/filesystem_view.py
@@ -201,9 +201,13 @@ class YamlFilesystemView(FilesystemView):
# Write projections file to new view
# Not strictly necessary as the empty file is the empty
# projection but it makes sense for consistency
- mkdirp(os.path.dirname(projections_path))
- with open(projections_path, 'w') as f:
- f.write(s_yaml.dump({'projections': self.projections}))
+ try:
+ mkdirp(os.path.dirname(projections_path))
+ 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):
# Write projections file to new view
mkdirp(os.path.dirname(projections_path))