def write_exclude(confhome, profile): import os # XXX possibly race when the user is mad ;) write_safe( os.path.join(confhome, profile['name'], 'exclude'), '\n'.join(profile['exclude'])+'\n' )
def write_qconf(confdir,qconf): import os from bprofile import write_safe qcnffile = os.path.join(confdir, 'conf.scdw') s='' if qconf.get('target'): s+="%s='%s'\n" % ('TARGET', qconf.get('target')) if qconf.get('key'): s+="%s='%s'\n" % ('GPG_KEY', qconf.get('key')) if qconf.get('password'): s+="%s='%s'\n" % ('GPG_PW', qconf.get('password')) write_safe(qcnffile, s)
def write_bprofile(confhome, cd): import os confdir = os.path.join(confhome, cd['name']) if not os.path.isdir(confdir): return "Profile not found in %s'" % confdir write_safe(os.path.join(confdir, "conf"), cd.get('conf',"# Empty config file. Use global settings.\n").replace('\r','')) write_safe(os.path.join(confdir, "source"), cd['source']+'\n') if cd.get('exclude'): write_exclude(confhome, cd) write_safe(os.path.join(confdir, "descr"), cd.get('descr','')+'\n'+cd.get('notes','').replace('\r',''))
def write_gconf(confhome, conf): import os write_safe(os.path.join(confhome, 'conf'), conf.replace('\r',''))