def build(recipe_dir): env = dict(os.environ) env.update(environ.get_dict()) env['RECIPE_DIR'] = recipe_dir for name in 'BIN', 'INC', 'LIB': path = env['LIBRARY_' + name] if not isdir(path): os.makedirs(path) src_dir = source.get_dir() bld_bat = join(recipe_dir, 'bld.bat') with open(bld_bat) as fi: data = fi.read() with open(join(src_dir, 'bld.bat'), 'w') as fo: fo.write(msvc_env_cmd()) # more debuggable with echo on fo.write('@echo on\n') for kv in env.iteritems(): fo.write('set %s=%s\n' % kv) fo.write("REM ===== end generated header =====\n") fo.write(data) cmd = [os.environ['COMSPEC'], '/c', 'bld.bat'] _check_call(cmd, cwd=src_dir) kill_processes() fix_staged_scripts()