#NEWLINE# def process_ha_config_upgrade( hass ) : #NEWLINE# #INDENT# 'Upgrade config if necessary.' #NEWLINE# version_path = hass . config . path ( '.HA_VERSION' ) #NEWLINE# try : #NEWLINE# #INDENT# with open ( version_path , 'rt' ) as inp : #NEWLINE# #INDENT# conf_version = inp . readline ( ) . strip ( ) #NEWLINE# #UNINDENT# #UNINDENT# except FileNotFoundError : #NEWLINE# #INDENT# conf_version = '0.7.7' #NEWLINE# #UNINDENT# if ( conf_version == __version__ ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# _LOGGER . info ( 'Upgrading config directory from %s to %s' , conf_version , __version__ ) #NEWLINE# lib_path = hass . config . path ( 'lib' ) #NEWLINE# if os . path . isdir ( lib_path ) : #NEWLINE# #INDENT# shutil . rmtree ( lib_path ) #NEWLINE# #UNINDENT# lib_path = hass . config . path ( 'deps' ) #NEWLINE# if os . path . isdir ( lib_path ) : #NEWLINE# #INDENT# shutil . rmtree ( lib_path ) #NEWLINE# #UNINDENT# with open ( version_path , 'wt' ) as outp : #NEWLINE# #INDENT# outp . write ( __version__ )