def generate(env): env['COG'] = exists(env) python = File(sys.executable).get_abspath() # windows fixes python = python.replace("\\", "\\\\") env['PYTHON'] = python # default cog flags env['COGFLAGS'] = ''.join([ '-d ', # deletes the generator code from the output '-e ', # warns if the input file has no cog code in it. '-I submods/xgen_ws ', # includes in python path '-I "%s" ' % TOOLS_DIR, # include the tools dir so cog_warnign can be imported '-D __COGFILE__="$SOURCE" ', # defines a global string for cog program ]) cmd = '$PYTHON -m cogapp -o $TARGET $COGFLAGS $SOURCE' env['COGCOM'] = cmd action = Action('$COGCOM', '$COGCOMSTR') bld = env.Builder( action=[action], emitter=emitter, ) env['BUILDERS']['Cog'] = bld env['BUILDERS']['rebuild_cog'] = rebuild_cog if not VERBOSE: env['COGCOMSTR'] = 'Processing $SOURCE --> $TARGET' AddOption("--cog", dest="cog", action="store_true", default=False, help="Forces .cog files to be rebuilt")
def generate(env): """ Add builders and construction variables for the SvnVersion builder. """ python = File(sys.executable).get_abspath() python = python.replace("\\", "\\\\") # windows fix env['PYTHON'] = python cmd = "$PYTHON $SOURCE install --user" env['PYTHONSETUPCOM'] = cmd action = Action('$PYTHONSETUPCOM', '$PYTHONSETUPCOMSTR') bld = env.Builder( action=[Delete("build"), action, Touch("$TARGETS")], emitter=emitter, target_factor=env.fs.Entry, src_suffic=".py", ) env['BUILDERS']['PythonSetup'] = bld