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:
		
				
					committed by
					
						
						Greg Becker
					
				
			
			
				
	
			
			
			
						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
 | 
				
			||||||
 | 
					                try:
 | 
				
			||||||
                    mkdirp(os.path.dirname(projections_path))
 | 
					                    mkdirp(os.path.dirname(projections_path))
 | 
				
			||||||
                    with open(projections_path, 'w') as f:
 | 
					                    with open(projections_path, 'w') as f:
 | 
				
			||||||
                        f.write(s_yaml.dump({'projections': self.projections}))
 | 
					                        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))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user