Пример #1
0
def get_plugin(name, uri):
    dst = abspath(BUNDLE_DIR, name)

    # Git repo
    if uri.endswith('git'):
        if os.path.isdir(dst) and os.path.isdir(abspath(dst, '.git')):
            # Update git repo (git pull)
            logger.debug("Fetching %s => %s" % (uri, dst))
            run_cmd('git pull origin master', cwd=dst)
        else:
            logger.debug("Cloning %s => %s" % (uri, dst))
            run_cmd('git clone %s %s' % (uri, dst))
Пример #2
0
def redefine_links():
    # Create links and backup if needed
    for src, dst in links:
        if os.path.islink(dst):
            orgpath = os.readlink(dst)
            logger.debug("Found link: %s => %s" % (dst, orgpath))
            os.remove(dst)
            logger.warn("Removed link %s " % dst)
        elif os.path.exists(dst):
            newpath = '%s-%s' % (dst, now.strftime(DATE_FORMAT))
            shutil.move(dst, newpath)
            logger.debug("Moved %s to %s" % (dst, newpath))
        else:
            logger.debug("No entry at %s" % dst)
        os.symlink(src, dst)
        logger.info("Created link %s ==> %s" % (dst, src))