config: includehandler: remove other checks that are no longer needed
Using the jsonschema module makes some checks in the includehandler redundant and can be removed. This patch does this. Signed-off-by: Claudius Heine <ch@denx.de>
This commit is contained in:
		
				
					committed by
					
						
						Daniel Wagner
					
				
			
			
				
	
			
			
			
						parent
						
							75fa095aa5
						
					
				
				
					commit
					f140d7905c
				
			@@ -77,30 +77,12 @@ def load_config(filename):
 | 
				
			|||||||
                                  'config file %s', filename)
 | 
					                                  'config file %s', filename)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        header = config.get('header', {})
 | 
					        version_value = int(config['header']['version'])
 | 
				
			||||||
    except AttributeError:
 | 
					 | 
				
			||||||
        raise LoadConfigException('Config does not contain a dictionary',
 | 
					 | 
				
			||||||
                                  filename)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if not header:
 | 
					 | 
				
			||||||
        raise LoadConfigException('Header missing or empty', filename)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    try:
 | 
					 | 
				
			||||||
        version = header.get('version', None)
 | 
					 | 
				
			||||||
    except AttributeError:
 | 
					 | 
				
			||||||
        raise LoadConfigException('Header is not a dictionary', filename)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if not version:
 | 
					 | 
				
			||||||
        raise LoadConfigException('Version missing or empty', filename)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    try:
 | 
					 | 
				
			||||||
        version_value = int(version)
 | 
					 | 
				
			||||||
    except ValueError:
 | 
					    except ValueError:
 | 
				
			||||||
        # Be compatible: version string '0.10' is equivalent to file version 1
 | 
					        # Be compatible: version string '0.10' is equivalent to file version 1
 | 
				
			||||||
        if isinstance(version, str) and version == '0.10':
 | 
					        # This check is already done in the config schema so here just set the
 | 
				
			||||||
 | 
					        # right version
 | 
				
			||||||
        version_value = 1
 | 
					        version_value = 1
 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            raise LoadConfigException('Unexpected version format', filename)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if version_value < __compatible_file_version__ or \
 | 
					    if version_value < __compatible_file_version__ or \
 | 
				
			||||||
       version_value > __file_version__:
 | 
					       version_value > __file_version__:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user