示例#1
0
文件: layer.py 项目: kimrhh/xd-tool
def run_add(args, manifest, env, subparser):
    try:
        url = layers[args.layer]
    except KeyError:
        log.error("Unknown layer: %s", args.layer)
        log.info("Use 'xd layer list' to show available layers")
        return "unknown layer"
    if not call('git submodule add %s %s' % (url, args.layer)):
        return 'git submodule add failed'
    if not call('git commit -m "Add %s layer" -- %s .gitmodules' %
                (args.layer, args.layer)):
        return 'git commit failed'
示例#2
0
def run_add(args, manifest, env, subparser):
    try:
        url = layers[args.layer]
    except KeyError:
        log.error("Unknown layer: %s", args.layer)
        log.info("Use 'xd layer list' to show available layers")
        return "unknown layer"
    if not call('git submodule add %s %s'%(url, args.layer)):
        return 'git submodule add failed'
    if not call('git commit -m "Add %s layer" -- %s .gitmodules'%(
            args.layer, args.layer)):
        return 'git commit failed'
示例#3
0
文件: init.py 项目: esben/xd-tool
def run(args, manifest, env):
    if not os.path.exists(".git"):
        if not call("git init"):
            return "git init failed"
    if not os.path.exists(".xd"):
        config = configparser.ConfigParser()
        config["manifest"] = {"abi": "0"}
        with open(".xd", "w") as f:
            config.write(f)
        if not call("git add .xd"):
            return "git add failed"
        if not call('git commit -m "Initial commit" -- .xd'):
            return "git commit failed"
    try:
        git_dir = git("rev-parse", git_dir=True)
    except sh.ErrorReturnCode as e:
        git_dir = None
    if git_dir != ".git\n":
        return "invalid manifest git dir"
    return
示例#4
0
文件: init.py 项目: kimrhh/xd-tool
def run(args, manifest, env):
    if not os.path.exists('.git'):
        if not call('git init'):
            return 'git init failed'
    if not os.path.exists('.xd'):
        config = configparser.ConfigParser()
        config['manifest'] = {'abi': '0'}
        with open('.xd', 'w') as f:
            config.write(f)
        if not call('git add .xd'):
            return 'git add failed'
        if not call('git commit -m "Initial commit" -- .xd'):
            return 'git commit failed'
    try:
        git_dir = git('rev-parse', git_dir=True)
    except sh.ErrorReturnCode as e:
        git_dir = None
    if git_dir != '.git\n':
        return 'invalid manifest git dir'
    return