def set_descriptions(config):
 log = logging.getLogger('gitosis.gitweb.set_descriptions')
 for (section, name, topdir, subpath) in enum_cfg_repos(config):
  try:
   description = config.get(section, 'description')
  except (NoSectionError, NoOptionError):
   continue
  if (not description):
   continue
  if (not os.path.exists(os.path.join(topdir, subpath))):
   log.warning(('Cannot find %(name)r in %(topdir)r' % dict(name=name, topdir=topdir)))
   continue
  path = os.path.join(topdir, subpath, 'description')
  tmp = ('%s.%d.tmp' % (path, os.getpid()))
  f = file(tmp, 'w')
  try:
   print >>f, description
  finally:
   f.close()
  os.rename(tmp, path)

def set_descriptions ( config ) : log = logging . getLogger ( 'gitosis.gitweb.set_descriptions' ) for ( section , name , topdir , subpath ) in enum_cfg_repos ( config ) : try : description = config . get ( section , 'description' ) except ( NoSectionError , NoOptionError ) : continue if ( not description ) : continue if ( not os . path . exists ( os . path . join ( topdir , subpath ) ) ) : log . warning ( ( 'Cannot find %(name)r in %(topdir)r' % dict ( name = name , topdir = topdir ) ) ) continue path = os . path . join ( topdir , subpath , 'description' ) tmp = ( '%s.%d.tmp' % ( path , os . getpid ( ) ) ) f = file ( tmp , 'w' ) try : print >> f , description finally : f . close ( ) os . rename ( tmp , path )
set descriptions for gitweb use .