Beispiel #1
0
def main(args):
    L.debug("main commander")
    parser = Parser(prog='commander.py')
    parser.add_argument("key", default=None, help=get_help())
    if len(args) > 0:
        arguments = [args.pop(0)]
        arguments = parser.parse_args(arguments)
        if arguments is None:
            pass
        else:
            key_found = arguments.key
            if key_found is not None:
                L.debug("find key:" + key_found)
                execute_func(key_found, args)
    else:
        parser.print_help()
Beispiel #2
0
def gen_hash(args):
    mode = ""
    if len(args) > 0:
        parser = Parser(prog=utils.abs_path('./android_build.py'))
        parser.add_argument("-m",
                            "--mode",
                            default=mode,
                            help="gen_hash() failed! |help: -m release|debug")
        arguments = parser.parse_args(args)
        mode = arguments.mode

    if mode == "debug":
        return _gen_hash_debug()
    if mode == "release":
        return _gen_hash_release()
    L.error("gen_hash() failed! |help: -m release|debug")
Beispiel #3
0
def main(args):
    gen = ""
    if len(args) > 1:
        parser = Parser(prog=utils.abs_path('./android_build.py'))
        parser.add_argument("-g",
                            "--gen",
                            default=gen,
                            help="gen() failed! |help: -g keystore|hash")
        arguments = [args.pop(0), args.pop(0)]
        arguments = parser.parse_args(arguments)
        gen = arguments.gen

    if gen == "keystore":
        gen_key(args)
    elif gen == "hash":
        gen_hash(args)
    else:
        L.error("failed! |help: android-gen -g keystore|hash")
Beispiel #4
0
def main(args):
    # load default config
    global default_folder_except
    global default_folder
    global default_ext
    global default_dst
    global default_src
    default_src = join_path(gv.client_path(), gv.gen_res_path())
    default_dst = join_path(gv.client_path(), gv.gen_dst_path())
    default_ext = gv.gen_ext()
    default_folder = gv.gen_folder()
    default_folder_except = gv.gen_folder_except()

    parser = Parser(prog='gen.py')
    parser.add_argument("-src",
                        "--source",
                        default=default_src,
                        help="folder res will gen, default=" + default_src)
    parser.add_argument("-dst",
                        "--destination",
                        default=default_dst,
                        help="destination file will save, default=" +
                        default_dst)
    parser.add_argument("-ext",
                        "--extension",
                        nargs='+',
                        default=default_ext,
                        help="list extension file will gen to res, default=" +
                        json.dumps(default_ext))
    parser.add_argument("-folder",
                        "--folder_gen",
                        nargs='+',
                        default=default_folder,
                        help="list folder will gen, default=" +
                        json.dumps(default_folder))
    parser.add_argument("-_folder",
                        "--folder_except",
                        nargs='+',
                        default=default_folder_except,
                        help="list folder will not gen, default=" +
                        json.dumps(default_folder_except))
    arguments = parser.parse_args(args)
    execute(arguments.source, arguments.destination, arguments.extension,
            arguments.folder_gen, arguments.folder_except)
Beispiel #5
0
def main(args):
    parser = Parser(prog=utils.abs_path('./http_server.py'))

    parser.add_argument("-port",
                        default=gv.cdn_port(),
                        help="port will run: default 8000")
    parser.add_argument("-address",
                        default='',
                        help="address bind, default any")
    parser.add_argument("-path",
                        default=gv.cdn_path(),
                        help="path will run http, default :" +
                        utils.abs_path(gv.cdn_path()))

    arguments = parser.parse_args(args)
    run(arguments.port, arguments.address, arguments.path)

    # parser = argparse.ArgumentParser()
    # parser.add_argument('--cgi', action='store_true',
    #                     help='Run as CGI Server')
    # parser.add_argument('--bind', '-b', default='', metavar='ADDRESS',
    #                     help='Specify alternate bind address '
    #                          '[default: all interfaces]')
    # parser.add_argument('port', action='store',
    #                     default=8000, type=int,
    #                     nargs='?',
    #                     help='Specify alternate port [default: 8000]')
    #
    # args = parser.parse_args()
    # if args.cgi:
    #     handler_class = CGIHTTPRequestHandler
    # else:
    #     handler_class = SimpleHTTPRequestHandler
    # http.server.test(HandlerClass=handler_class, port=args.port, bind=args.bind)
    pass
Beispiel #6
0
def main(args):
    # load default
    num_version = gv.cdn_version()
    client_path = gv.client_path()
    package_url = gv.cdn_package_url()
    cdn_deploy_path = gv.cdn_path()
    dst_project_manifest = gv.client_path()
    folder_will_gen = gv.cdn_manifest_folder_gen()

    if len(args) > 0:
        parser = Parser(prog=utils.abs_path('./update_manifest.py'))
        parser.add_argument("-ver",
                            "--version",
                            default=num_version,
                            help="version manifest")
        parser.add_argument("-cli",
                            "--client_path",
                            default=client_path,
                            help="version manifest")
        parser.add_argument("-pak",
                            "--package_url",
                            default=package_url,
                            help="version manifest")
        parser.add_argument("-cdn",
                            "--cdn_path",
                            default=cdn_deploy_path,
                            help="version manifest")
        parser.add_argument("-dst",
                            "--dst_project_manifest",
                            default=dst_project_manifest,
                            help="version manifest")
        parser.add_argument("-fol",
                            "--folder_gen",
                            default=folder_will_gen,
                            help="version manifest")
        arguments = parser.parse_args(args)
        num_version = arguments.version
        client_path = arguments.client_path
        package_url = arguments.package_url
        cdn_deploy_path = arguments.cdn_path
        dst_project_manifest = arguments.dst_project_manifest
        folder_will_gen = arguments.folder_gen

    gen_manifest(num_version, client_path, package_url, cdn_deploy_path,
                 dst_project_manifest, folder_will_gen)
    if gv.cdn_auto_increment():
        nums = num_version.split(".")
        nums[-1] = int(nums[-1]) + 1
        num_version = '.'.join(str(x) for x in nums)
        gv.cdn_set_version(num_version)
        gv.save()