def make_changed_file(path, env):
 def remove_file(path):
  try:
   os.remove(path)
  except OSError:
   pass
 latest = get_installable_version(version)
 new_path = remove_extension(path)
 with open(path, 'r') as templated_file:
  with open(new_path, 'w') as new_file:
   new_file.write(templated_file.read().replace(PLACEHOLDER, latest))
   env.app.connect('build-finished', (lambda self, *args: remove_file(new_path)))

def make_changed_file ( path , env ) : def remove_file ( path ) : try : os . remove ( path ) except OSError : pass latest = get_installable_version ( version ) new_path = remove_extension ( path ) with open ( path , 'r' ) as templated_file : with open ( new_path , 'w' ) as new_file : new_file . write ( templated_file . read ( ) . replace ( PLACEHOLDER , latest ) ) env . app . connect ( 'build-finished' , ( lambda self , * args : remove_file ( new_path ) ) )
given the path to a template file .