PackageStillNeededError: add pkg that needs spec to exception msg (#43845)
* PackageStillNeededError: add pkg that needs spec to exception msg * PackageStillNeededError: f-string with short fmt and hash * PackageStillNeededError: split long string
This commit is contained in:
		@@ -2555,7 +2555,12 @@ class PackageStillNeededError(InstallError):
 | 
			
		||||
    """Raised when package is still needed by another on uninstall."""
 | 
			
		||||
 | 
			
		||||
    def __init__(self, spec, dependents):
 | 
			
		||||
        super().__init__("Cannot uninstall %s" % spec)
 | 
			
		||||
        spec_fmt = spack.spec.DEFAULT_FORMAT + " /{hash:7}"
 | 
			
		||||
        dep_fmt = "{name}{@versions} /{hash:7}"
 | 
			
		||||
        super().__init__(
 | 
			
		||||
            f"Cannot uninstall {spec.format(spec_fmt)}, "
 | 
			
		||||
            f"needed by {[dep.format(dep_fmt) for dep in dependents]}"
 | 
			
		||||
        )
 | 
			
		||||
        self.spec = spec
 | 
			
		||||
        self.dependents = dependents
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user