python: mkvenv: tweak the matching of --diagnose to depspecs
Move the matching between the "absent" array and dep_specs[0] inside the loop, preparing for the possibility of having multiple canaries among the installed packages. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									87f77f58d8
								
							
						
					
					
						commit
						67b9a83daf
					
				@ -806,6 +806,7 @@ def _do_ensure(
 | 
				
			|||||||
    """
 | 
					    """
 | 
				
			||||||
    absent = []
 | 
					    absent = []
 | 
				
			||||||
    present = []
 | 
					    present = []
 | 
				
			||||||
 | 
					    canary = None
 | 
				
			||||||
    for spec in dep_specs:
 | 
					    for spec in dep_specs:
 | 
				
			||||||
        matcher = distlib.version.LegacyMatcher(spec)
 | 
					        matcher = distlib.version.LegacyMatcher(spec)
 | 
				
			||||||
        ver = _get_version(matcher.name)
 | 
					        ver = _get_version(matcher.name)
 | 
				
			||||||
@ -817,6 +818,8 @@ def _do_ensure(
 | 
				
			|||||||
            or not matcher.match(distlib.version.LegacyVersion(ver))
 | 
					            or not matcher.match(distlib.version.LegacyVersion(ver))
 | 
				
			||||||
        ):
 | 
					        ):
 | 
				
			||||||
            absent.append(spec)
 | 
					            absent.append(spec)
 | 
				
			||||||
 | 
					            if spec == dep_specs[0]:
 | 
				
			||||||
 | 
					                canary = prog
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            logger.info("found %s %s", matcher.name, ver)
 | 
					            logger.info("found %s %s", matcher.name, ver)
 | 
				
			||||||
            present.append(matcher.name)
 | 
					            present.append(matcher.name)
 | 
				
			||||||
@ -839,7 +842,7 @@ def _do_ensure(
 | 
				
			|||||||
            absent[0],
 | 
					            absent[0],
 | 
				
			||||||
            online,
 | 
					            online,
 | 
				
			||||||
            wheels_dir,
 | 
					            wheels_dir,
 | 
				
			||||||
            prog if absent[0] == dep_specs[0] else None,
 | 
					            canary,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return None
 | 
					    return None
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user