def build_swf(ctx): """ Build the meerkat AS library and then generate all suite SWFs. A SWF test is defined as under src directory that have the format swf/main.as """ tests = buildmeta.get_tests(ctx) rule = '${MXMLC} -source-path=%s -output ${TGT} ${SRC}' swf_suite = ctx.path.find_or_declare('swf/suite') for f in ctx.path.ant_glob('src/suite/**/swf/main.as'): rel_path = f.srcpath() split_namespace = rel_path.split(os.path.sep)[2:-2] namespace = '_'.join(split_namespace) c = tests.add('swf', namespace) p = swf_suite.find_or_declare(os.path.join(*split_namespace)) generate_meerkat_lib(ctx, p, server_url=ctx.env.PROTOCOL + '://localhost:23456/' + namespace, amf_encoding=ctx.options.amf_encoding) tgt = swf_suite.find_or_declare(namespace + '.swf') ctx(rule=rule % (p.abspath(),), source=f, target=tgt) c['file'] = tgt.bldpath()
def build_apps(ctx): """ Copies all src/test/suite/name/fms/* to build/fms/test_suite_name/* The contents in build/fms can then be dropped into an FMS install and restarted. """ tests = buildmeta.get_tests(ctx) import shutil fms_build = ctx.path.find_or_declare('fms') for f in ctx.path.ant_glob('src/suite/**/fms/main.asc'): app_src_dir = f.parent rel_path = f.abspath()[len(ctx.top_dir):].strip(os.path.sep) split_path = rel_path.split(os.path.sep) swf_namespace = split_path[2:-2] c = tests.add('fms', '_'.join(swf_namespace)) app_node = fms_build.find_or_declare('_'.join(swf_namespace)) try: shutil.rmtree(app_node.abspath()) except OSError: pass shutil.copytree(app_src_dir.abspath(), app_node.abspath()) c['app'] = app_node.nice_path() c['app_name'] = '_'.join(swf_namespace)
def build_apps(ctx): """ """ tests = buildmeta.get_tests(ctx) server_build_node = ctx.path.find_or_declare('python/server') for f in ctx.path.ant_glob('src/suite/**/python/server.py'): rel_path = f.srcpath() split_path = rel_path.split(os.path.sep) test_namespace = split_path[2:-2] module = '_'.join(test_namespace) c = tests.add('py_server', module) app_node = server_build_node.find_or_declare(module + '.py') try: os.unlink(app_node.abspath()) except OSError: pass try: shutil.copy2(f.abspath(), app_node.abspath()) except OSError: ctx.fatal('Unable to copy python server app %r (path:%r)' % ( module, app_node.bldpath())) c['file'] = app_node.bldpath() c['module'] = module
def deploy_fms_apps(ctx): """ """ tests = buildmeta.get_tests(ctx) context = ctx.env.get_merged_dict().copy() fms_deploy = ctx.path.find_or_declare('fms-deploy') fms_build = ctx.path.find_or_declare('fms') lines = [] for name in tests: app_dir = fms_build.find_or_declare(name) c = context.copy() c.update({'APP_NAME': name, 'APP_DIR': app_dir.abspath()}) lines.append('%(SSH)s %(FMS_USER)s@%(FMS_HOST)s "rm -rf %(FMS_DIR)s/%(APP_NAME)s"' % c) lines.append('%(SCP)s -r %(APP_DIR)s %(FMS_USER)s@%(FMS_HOST)s:%(FMS_DIR)s' % c) fms_deploy.write('\n'.join(lines) + '\n', 'w+') os.chmod(fms_deploy.abspath(), 0755)