fix prints

This commit is contained in:
Simon Stürz 2017-03-06 21:06:34 +01:00 committed by Michael Zanetti
parent 308aef672b
commit 7273e35adf

View File

@ -42,12 +42,12 @@ def printInfo(info):
#----------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------
def printWarning(warning): def printWarning(warning):
print("Warning:" + warning) print('Warning: ' + warning)
#----------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------
def printError(error): def printError(error):
print('Error:' + error) print('Error: ' + error)
#----------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------
@ -86,7 +86,7 @@ def extractParamTypes(paramTypes, contextName):
addTranslationString(paramType['name'], 'The name of the paramType (%s) of %s' % (paramType['id'], contextName)) addTranslationString(paramType['name'], 'The name of the paramType (%s) of %s' % (paramType['id'], contextName))
createExternDefinition('ParamTypeId', variableName) createExternDefinition('ParamTypeId', variableName)
else: else:
printWarning('Duplicated variable name \"%s\" for ParamTypeId %s -> skipping') % (variableName, paramType['id']) printWarning('Duplicated variable name \"%s\" for ParamTypeId %s -> skipping' % (variableName, paramType['id']))
except: except:
pass pass
@ -104,7 +104,7 @@ def extractVendors(vendors):
addTranslationString(vendor['name'], 'The name of the vendor (%s)' % vendor['id']) addTranslationString(vendor['name'], 'The name of the vendor (%s)' % vendor['id'])
createExternDefinition('VendorId', variableName) createExternDefinition('VendorId', variableName)
else: else:
printWarning('Duplicated variable name \"%s\" for VendorId %s -> skipping') % (variableName, param['id']) printWarning('Duplicated variable name \"%s\" for VendorId %s -> skipping' % (variableName, param['id']))
except: except:
pass pass
@ -129,7 +129,7 @@ def extractDeviceClasses(deviceClasses):
addTranslationString(deviceClass['name'], 'The name of the DeviceClass (%s)' %(deviceClass['id'])) addTranslationString(deviceClass['name'], 'The name of the DeviceClass (%s)' %(deviceClass['id']))
createExternDefinition('DeviceClassId', variableName) createExternDefinition('DeviceClassId', variableName)
else: else:
printWarning('Duplicated variable name \"%s\" for DeviceClassId %s -> skipping') % (variableName, deviceClass['deviceClassId']) printWarning('Duplicated variable name \"%s\" for DeviceClassId %s -> skipping' % (variableName, deviceClass['deviceClassId']))
except: except:
pass pass
@ -164,7 +164,7 @@ def extractStateTypes(stateTypes, deviceClassName):
writeToFile('StateTypeId %s = StateTypeId(\"%s\");' % (variableName, stateType['id'])) writeToFile('StateTypeId %s = StateTypeId(\"%s\");' % (variableName, stateType['id']))
createExternDefinition('StateTypeId', variableName) createExternDefinition('StateTypeId', variableName)
else: else:
printWarning('Duplicated variable name \"%s\" for StateTypeId %s -> skipping') % (variableName, stateType['id']) printWarning('Duplicated variable name \"%s\" for StateTypeId %s -> skipping' % (variableName, stateType['id']))
# Create EventTypeId for this state # Create EventTypeId for this state
variableName = '%sEventTypeId' % (stateType['idName']) variableName = '%sEventTypeId' % (stateType['idName'])
@ -176,7 +176,7 @@ def extractStateTypes(stateTypes, deviceClassName):
writeToFile('EventTypeId %s = EventTypeId(\"%s\");' % (variableName, stateType['id'])) writeToFile('EventTypeId %s = EventTypeId(\"%s\");' % (variableName, stateType['id']))
createExternDefinition('EventTypeId', variableName) createExternDefinition('EventTypeId', variableName)
else: else:
printWarning('Duplicated variable name \"%s\" for autocreated EventTypeId %s -> skipping') % (variableName, stateType['id']) printWarning('Duplicated variable name \"%s\" for autocreated EventTypeId %s -> skipping' % (variableName, stateType['id']))
#ParamType for EventType/ActionType #ParamType for EventType/ActionType
variableName = '%sStateParamTypeId' % (stateType['idName']) variableName = '%sStateParamTypeId' % (stateType['idName'])
@ -188,7 +188,7 @@ def extractStateTypes(stateTypes, deviceClassName):
createExternDefinition('ParamTypeId', variableName) createExternDefinition('ParamTypeId', variableName)
addTranslationString(stateType['name'], 'The name of the ParamType of StateType (%s) of DeviceClass %s' % (stateType['id'], deviceClassName)) addTranslationString(stateType['name'], 'The name of the ParamType of StateType (%s) of DeviceClass %s' % (stateType['id'], deviceClassName))
else: else:
printWarning('duplicated variable name \"%s\" for ParamTypeId %s -> skipping') % (variableName, stateType['id']) printWarning('Duplicated variable name \"%s\" for ParamTypeId %s -> skipping' % (variableName, stateType['id']))
# Create ActionTypeId if the state is writable # Create ActionTypeId if the state is writable
if 'writable' in stateType and stateType['writable']: if 'writable' in stateType and stateType['writable']:
@ -201,7 +201,7 @@ def extractStateTypes(stateTypes, deviceClassName):
writeToFile('ActionTypeId %s = ActionTypeId(\"%s\");' % (variableName, stateType['id'])) writeToFile('ActionTypeId %s = ActionTypeId(\"%s\");' % (variableName, stateType['id']))
createExternDefinition('ActionTypeId', variableName) createExternDefinition('ActionTypeId', variableName)
else: else:
printWarning('Duplicated variable name \"%s\" for autocreated ActionTypeId %s -> skipping') % (variableName, stateType['id']) printWarning('Duplicated variable name \"%s\" for autocreated ActionTypeId %s -> skipping' % (variableName, stateType['id']))
except: except:
pass pass
@ -220,7 +220,7 @@ def extractActionTypes(actionTypes, deviceClassName):
writeToFile('ActionTypeId %s = ActionTypeId(\"%s\");' % (variableName, actionType['id'])) writeToFile('ActionTypeId %s = ActionTypeId(\"%s\");' % (variableName, actionType['id']))
createExternDefinition('ActionTypeId', variableName) createExternDefinition('ActionTypeId', variableName)
else: else:
printWarning('Duplicated variable name \"%s\" for ActionTypeId %s -> skipping') % (variableName, actionType['id']) printWarning('Duplicated variable name \"%s\" for ActionTypeId %s -> skipping' % (variableName, actionType['id']))
except: except:
pass pass
@ -243,7 +243,7 @@ def extractEventTypes(eventTypes, deviceClassName):
writeToFile('EventTypeId %s = EventTypeId(\"%s\");' % (variableName, eventType['id'])) writeToFile('EventTypeId %s = EventTypeId(\"%s\");' % (variableName, eventType['id']))
createExternDefinition('EventTypeId', variableName) createExternDefinition('EventTypeId', variableName)
else: else:
printWarning('Duplicated variable name \"%s\" for EventTypeId %s -> skipping') % (variableName, eventType['id']) printWarning('Duplicated variable name \"%s\" for EventTypeId %s -> skipping' % (variableName, eventType['id']))
except: except:
pass pass
@ -301,7 +301,7 @@ def createTranslationFiles():
#----------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------
def writePluginInfoFile(): def writePluginInfoFile():
printInfo(' --> generate plugininfo.h for plugin \"%s\" = %s' % (pluginMap['name'], pluginMap['id'])) print(' --> Generate plugininfo.h for plugin \"%s\" = %s' % (pluginMap['name'], pluginMap['id']))
writeToFile('/* This file is generated by the guh build system. Any changes to this file will') writeToFile('/* This file is generated by the guh build system. Any changes to this file will')
writeToFile(' * be lost.') writeToFile(' * be lost.')
@ -335,7 +335,7 @@ def writePluginInfoFile():
writeToFile('') writeToFile('')
writeToFile('#endif // PLUGININFO_H') writeToFile('#endif // PLUGININFO_H')
outputFile.close() outputFile.close()
printInfo(' --> generated successfully \"%s\"' % (args.output)) print(' --> Generated successfully \"%s\"' % (args.output))
# Translate # Translate
if len(translationStrings) is not 0: if len(translationStrings) is not 0:
@ -344,7 +344,7 @@ def writePluginInfoFile():
#----------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------
def writeExternPluginInfoFile(): def writeExternPluginInfoFile():
print(' --> generate extern-plugininfo.h for plugin \"%s\" = %s' % (pluginMap['name'], pluginMap['id'])) print(' --> Generate extern-plugininfo.h for plugin \"%s\" = %s' % (pluginMap['name'], pluginMap['id']))
extractPlugin(pluginMap) extractPlugin(pluginMap)
writeToFile('/* This file is generated by the guh build system. Any changes to this file will') writeToFile('/* This file is generated by the guh build system. Any changes to this file will')
writeToFile(' * be lost.') writeToFile(' * be lost.')
@ -372,7 +372,7 @@ def writeExternPluginInfoFile():
writeToFile('') writeToFile('')
writeToFile('#endif // EXTERNPLUGININFO_H') writeToFile('#endif // EXTERNPLUGININFO_H')
outputFile.close() outputFile.close()
print(' --> generated successfully \'%s\'' % (args.output)) print(' --> Generated successfully \'%s\'' % (args.output))
################################################################################################################## ##################################################################################################################