#NEWLINE# def save( self , pypi_version , current_time ) : #NEWLINE# #INDENT# if ( not check_path_owner ( os . path . dirname ( self . statefile_path ) ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# ensure_dir ( os . path . dirname ( self . statefile_path ) ) #NEWLINE# with lockfile . LockFile ( self . statefile_path ) : #NEWLINE# #INDENT# if os . path . exists ( self . statefile_path ) : #NEWLINE# #INDENT# with open ( self . statefile_path ) as statefile : #NEWLINE# #INDENT# state = json . load ( statefile ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# state = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# state [ sys . prefix ] = { #NEWLINE# #INDENT# 'last_check' : current_time . strftime ( SELFCHECK_DATE_FMT ) , #NEWLINE# 'pypi_version' : pypi_version , #NEWLINE# #UNINDENT# } #NEWLINE# with open ( self . statefile_path , 'w' ) as statefile : #NEWLINE# #INDENT# json . dump ( state , statefile , sort_keys = True , separators = ( ',' , ':' ) )