def generate_frontpage_pngs(only_if_needed=True):
 for (fn_png, fn_py) in FRONTPAGE_PNGS.items():
  pn_png = os.path.join(FRONTPAGE_PNG_PATH, fn_png)
  pn_py = os.path.join(FRONTPAGE_PY_PATH, fn_py)
  mtime_py = os.path.getmtime(pn_py)
  mtime_png = (os.path.getmtime(pn_png) if os.path.exists(pn_png) else (mtime_py - 1))
  if (only_if_needed and (mtime_py <= mtime_png)):
   continue
  subprocess.check_call(['python', pn_py])
  os.rename(fn_png, pn_png)

def generate_frontpage_pngs ( only_if_needed = True ) : for ( fn_png , fn_py ) in FRONTPAGE_PNGS . items ( ) : pn_png = os . path . join ( FRONTPAGE_PNG_PATH , fn_png ) pn_py = os . path . join ( FRONTPAGE_PY_PATH , fn_py ) mtime_py = os . path . getmtime ( pn_py ) mtime_png = ( os . path . getmtime ( pn_png ) if os . path . exists ( pn_png ) else ( mtime_py - 1 ) ) if ( only_if_needed and ( mtime_py <= mtime_png ) ) : continue subprocess . check_call ( [ 'python' , pn_py ] ) os . rename ( fn_png , pn_png )
executes the scripts for png generation of the top row of index .