Beispiel #1
0
def dump(config, savedir, symlink=False):
    if 'active' in config and config['active'] in ('false', 'off', '0'):
        return

    if 'src' in config:
        src = config['src']
    else:
        src = config['dir']

    if 'ignore' in config:
        ignore = ignore_patterns(*[p.strip() for p in config['ignore'].split(',')])
    else:
        ignore = None

    run_hook('pre-create-code', [config['project'], src], logger=logger, exit_on_error=True)

    makedirs_silent(savedir)
    dest = os.path.join(savedir, config['project'])
    if symlink:
        logger.info("symlink '%(src)s' to '%(dest)s'" % {'src': src, 'dest': dest})
        symlink_silent(src, dest)
    else:
        logger.info("copy '%(src)s' to '%(dest)s'" % {'src': src, 'dest': dest})
        copytree(src, dest, symlinks=True, ignore=ignore)

    run_hook('post-create-code', [config['project'], src], logger=logger)
Beispiel #2
0
def dump(config, savedir, symlink=False):
    if 'active' in config and config['active'] in ('false', 'off', '0'):
        return

    dirs = get_dirs(config['dirs'])

    if 'ignore' in config:
        ignore = ignore_patterns(*[p.strip() for p in config['ignore'].split(',')])
    else:
        ignore = None

    for src in dirs:
        if src.startswith('/'):
            dest = os.path.join(savedir, src[1:])
            if src.endswith('/'):
                dest = dest[:-1]
        else:
            logger.error("'%s' is not an absolute path" % src)
            sys.exit(1)

        if symlink:
            makedirs_silent(os.path.dirname(dest))
            logger.info("symlink '%(src)s' to '%(dest)s'" % {'src': src, 'dest': dest})
            symlink_silent(src, dest)
        else:
            logger.info("copying '%(src)s' to '%(dest)s'" % {'src': src, 'dest': dest})
            copytree(src, dest, symlinks=True, ignore=ignore, update_rights=True)
Beispiel #3
0
def copy_hooks(hooks, dest):
    logger.debug("copy hooks from '%(hooks)s' to '%(dest)s'" % {"hooks": hooks, "dest": dest})
    copytree(hooks, os.path.join(dest, basename(hooks)), ignore=ignore_patterns(".svn"))