Fix "specific target" detection in Python 3 (#12906)
The output of subprocess.check_output is a byte string in Python 3. This causes dictionary lookup to fail later on. A try-except around this function prevented this error from being noticed. Removed this so that more errors can propagate out.
This commit is contained in:
		
				
					committed by
					
						
						Todd Gamblin
					
				
			
			
				
	
			
			
			
						parent
						
							6cd5edacca
						
					
				
				
					commit
					065cbe89fe
				
			@@ -7,7 +7,7 @@
 | 
			
		||||
import platform
 | 
			
		||||
import re
 | 
			
		||||
import subprocess
 | 
			
		||||
import sys
 | 
			
		||||
import warnings
 | 
			
		||||
 | 
			
		||||
import six
 | 
			
		||||
 | 
			
		||||
@@ -76,11 +76,8 @@ def proc_cpuinfo():
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def check_output(args):
 | 
			
		||||
    if sys.version_info[:2] == (2, 6):
 | 
			
		||||
        return subprocess.run(
 | 
			
		||||
            args, check=True, stdout=subprocess.PIPE).stdout  # nopyqver
 | 
			
		||||
    else:
 | 
			
		||||
        return subprocess.check_output(args)  # nopyqver
 | 
			
		||||
    output = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()[0]
 | 
			
		||||
    return six.text_type(output.decode('utf-8'))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@info_dict(operating_system='Darwin')
 | 
			
		||||
@@ -126,8 +123,8 @@ def raw_info_dictionary():
 | 
			
		||||
    for factory in info_factory[platform.system()]:
 | 
			
		||||
        try:
 | 
			
		||||
            info = factory()
 | 
			
		||||
        except Exception:
 | 
			
		||||
            pass
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            warnings.warn(str(e))
 | 
			
		||||
 | 
			
		||||
        if info:
 | 
			
		||||
            break
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user