Fix color bug in Spec.format() introduced by #3013
This commit is contained in:
		@@ -2706,11 +2706,8 @@ def format(self, format_string='$_$@$%@+$+$=', **kwargs):
 | 
			
		||||
        named_str = fmt = ''
 | 
			
		||||
 | 
			
		||||
        def write(s, c):
 | 
			
		||||
            if color:
 | 
			
		||||
                f = color_formats[c] + cescape(s) + '@.'
 | 
			
		||||
                cwrite(f, stream=out, color=color)
 | 
			
		||||
            else:
 | 
			
		||||
                out.write(s)
 | 
			
		||||
            f = color_formats[c] + cescape(s) + '@.'
 | 
			
		||||
            cwrite(f, stream=out, color=color)
 | 
			
		||||
 | 
			
		||||
        iterator = enumerate(format_string)
 | 
			
		||||
        for i, c in iterator:
 | 
			
		||||
@@ -2802,7 +2799,7 @@ def write(s, c):
 | 
			
		||||
                        write(fmt % str(self.variants), '+')
 | 
			
		||||
                elif named_str == 'ARCHITECTURE':
 | 
			
		||||
                    if self.architecture and str(self.architecture):
 | 
			
		||||
                        write(fmt % str(self.architecture), ' arch=')
 | 
			
		||||
                        write(fmt % str(self.architecture), '=')
 | 
			
		||||
                elif named_str == 'SHA1':
 | 
			
		||||
                    if self.dependencies:
 | 
			
		||||
                        out.write(fmt % str(self.dag_hash(7)))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user