示例#1
0
def build_dep(dep=None, deps_dir=None, channel='prod', specific_tags=False):
    repo = REPO_ROOT + dep
    target = os.path.join(deps_dir, dep)
    if os.path.exists(target):
        os.chdir(target)
        if is_git():
            run('git fetch')
        else:
            run('hg pull')
    else:
        # let's try to detect the repo kind with a few heuristics
        if _is_git_repo(repo):
            run('git clone %s %s' % (repo, target))
        else:
            run('hg clone %s %s' % (repo, target))

        os.chdir(target)

    if has_changes():
        if channel != 'dev':
            print('the code was changed, aborting!')
            sys.exit(0)
        else:
            print('Warning: the code was changed/')

    cmd = update_cmd(dep, channel, specific_tags)
    run(cmd)
    run('%s setup.py develop' % PYTHON)
示例#2
0
def updating_repo(name, channel, specific_tags, force=False, timeout=60,
                  verbose=False):
    if not force and has_changes(timeout, verbose) and channel != 'dev':
        print('The code was changed locally, aborting!')
        print('You can use --force but all uncommited '
              'changes will be discarded.')
        sys.exit(0)

    if is_git():
        run('git submodule update')

    run(update_cmd(name, channel, specific_tags, force), timeout, verbose)
def updating_repo(name,
                  channel,
                  specific_tags,
                  force=False,
                  timeout=60,
                  verbose=False):
    if not force and has_changes(timeout, verbose) and channel != 'dev':
        print('The code was changed locally, aborting!')
        print('You can use --force but all uncommited '
              'changes will be discarded.')
        sys.exit(0)

    if is_git():
        run('git submodule update')

    run(update_cmd(name, channel, specific_tags, force), timeout, verbose)
def build_dep(dep=None,
              deps_dir=None,
              channel='prod',
              specific_tags=False,
              timeout=300,
              verbose=False):

    # using REPO_ROOT if the provided dep is not an URL
    is_url = False
    for scheme in _REPO_SCHEMES:
        if dep.startswith(scheme):
            is_url = True
            break

    if not is_url:
        repo = REPO_ROOT + dep
    else:
        repo = dep

    target = os.path.join(deps_dir, os.path.basename(dep))
    if os.path.exists(target):
        os.chdir(target)
        if is_git():
            run('git fetch')
        else:
            run('hg pull')
    else:
        # let's try to detect the repo kind with a few heuristics
        if _is_git_repo(repo):
            run('git clone %s %s' % (repo, target))
        else:
            run('hg clone %s %s' % (repo, target))

        os.chdir(target)

    if has_changes(timeout, verbose):
        if channel != 'dev':
            print('The code was changed, aborting !')
            print('Use the dev channel if you change locally the code')
            sys.exit(0)
        else:
            print('Warning: the code was changed.')

    cmd = update_cmd(dep, channel, specific_tags)
    run(cmd, timeout, verbose)
    run('%s setup.py develop' % PYTHON, timeout, verbose)
示例#5
0
def build_dep(dep=None, deps_dir=None, channel='prod', specific_tags=False,
              timeout=300, verbose=False):

    # using REPO_ROOT if the provided dep is not an URL
    is_url = False
    for scheme in _REPO_SCHEMES:
        if dep.startswith(scheme):
            is_url = True
            break

    if not is_url:
        repo = REPO_ROOT + dep
    else:
        repo = dep

    target = os.path.join(deps_dir, os.path.basename(dep))
    if os.path.exists(target):
        os.chdir(target)
        if is_git():
            run('git fetch')
        else:
            run('hg pull')
    else:
        # let's try to detect the repo kind with a few heuristics
        if _is_git_repo(repo):
            run('git clone %s %s' % (repo, target))
        else:
            run('hg clone %s %s' % (repo, target))

        os.chdir(target)

    if has_changes(timeout, verbose):
        if channel != 'dev':
            print('The code was changed, aborting !')
            print('Use the dev channel if you change locally the code')
            sys.exit(0)
        else:
            print('Warning: the code was changed.')

    cmd = update_cmd(dep, channel, specific_tags)
    run(cmd, timeout, verbose)
    run('%s setup.py develop' % PYTHON, timeout, verbose)
def _build_rpm(channel, options):
    if has_changes() and channel != 'dev' and not options.force:
        print('The code was changed, aborting !')
        print('Use the dev channel if you change locally the code')
        sys.exit(0)

    # removing any build dir
    if os.path.exists('build'):
        shutil.rmtree('build')

    cmd_options = {'dist': options.dist_dir}
    cmd = ("--command-packages=pypi2rpm.command bdist_rpm2 "
           "--dist-dir=%(dist)s --binary-only")

    # where's the spec file ?
    spec_file = get_spec_file()

    # if there's a spec file we use it
    if spec_file is not None:
        cmd_options['spec'] = spec_file
        cmd += ' --spec-file=%(spec)s'
    else:
        # if not we define a python-name for the rpm
        # grab the name and create a normalized one
        popen = subprocess.Popen('%s setup.py --name' % sys.executable,
                                 stdout=subprocess.PIPE,
                                 shell=True)
        name = [line for line in popen.stdout.read().split('\n') if line != '']
        name = name[-1].strip().lower()

        if not name.startswith('python'):
            name = '%s-%s' % (_PYTHON, name)
        elif name.startswith('python-'):
            name = '%s-%s' % (_PYTHON, name[len('python-'):])

        cmd_options['name'] = name
        cmd += ' --name=%(name)s'

    # now running the cmd
    run('%s setup.py %s' % (PYTHON, cmd % cmd_options))
示例#7
0
def _build_rpm(channel, options):
    if has_changes() and channel != 'dev':
        print('the code was changed, aborting!')
        sys.exit(0)

    # removing any build dir
    if os.path.exists('build'):
        shutil.rmtree('build')

    # where's the spec file ?
    spec_file = get_spec_file()

    if spec_file is None:
        return

    cmd_options = {'spec': spec_file, 'dist': options.dist_dir}

    # now running the cmd
    cmd = ("--command-packages=pypi2rpm.command bdist_rpm2 "
           "--spec-file=%(spec)s --dist-dir=%(dist)s")

    run('%s setup.py %s' % (PYTHON, cmd % cmd_options))
示例#8
0
def _build_rpm(channel, options):
    if has_changes() and channel != 'dev' and not options.force:
        print('The code was changed, aborting !')
        print('Use the dev channel if you change locally the code')
        sys.exit(0)

    # removing any build dir
    if os.path.exists('build'):
        shutil.rmtree('build')

    cmd_options = {'dist': options.dist_dir}
    cmd = ("--command-packages=pypi2rpm.command bdist_rpm2 "
           "--dist-dir=%(dist)s --binary-only")

    # where's the spec file ?
    spec_file = get_spec_file()

    # if there's a spec file we use it
    if spec_file is not None:
        cmd_options['spec'] = spec_file
        cmd += ' --spec-file=%(spec)s'
    else:
        # if not we define a python-name for the rpm
        # grab the name and create a normalized one
        popen = subprocess.Popen('%s setup.py --name' % sys.executable,
                                 stdout=subprocess.PIPE, shell=True)
        name = [line for line in popen.stdout.read().split('\n') if line != '']
        name = name[-1].strip().lower()

        if not name.startswith('python'):
            name = '%s-%s' % (_PYTHON, name)
        elif name.startswith('python-'):
            name = '%s-%s' % (_PYTHON, name[len('python-'):])

        cmd_options['name'] = name
        cmd += ' --name=%(name)s'

    # now running the cmd
    run('%s setup.py %s' % (PYTHON, cmd % cmd_options))