예제 #1
0
def checkout(pkg, commit, repos=repos):
    vcs = repos[pkg]
    status = 0
    if vcs in ('svn', 'git'):
        checkout_vcs(pkg, commit, vcs=vcs)
        status = sh('pip install --no-index --no-deps -U ./%s'%pkg)
    else:
        status = sh('pip install -U %s==%s'%(pkg,commit))
    return status
예제 #2
0
def checkout(pkg, commit, repos=repos):
    vcs = repos[pkg]
    status = 0
    if vcs in ('svn', 'git'):
        checkout_vcs(pkg, commit, vcs=vcs)
        status = sh('pip install --no-index --no-deps -U ./%s' % pkg)
    else:
        status = sh('pip install -U %s==%s' % (pkg, commit))
    return status
예제 #3
0
def checkout_vcs(pkg, commit, vcs='git', pkg_dir=pkg_dir):
    d = pkg_dir / pkg
    d.chdir()

    commit = str(commit)
    if vcs == 'svn':
        sh('svn update -r %s' % commit)
    elif vcs == 'git':
        sh('git checkout %s' % commit)
    curdir.chdir()
예제 #4
0
def checkout_vcs(pkg, commit, vcs='git', pkg_dir=pkg_dir):
    d = pkg_dir / pkg
    d.chdir()

    commit = str(commit)
    if vcs == 'svn':
        sh('svn update -r %s'%commit)
    elif vcs == 'git':
        sh('git checkout %s'%commit)
    curdir.chdir()
예제 #5
0
    def local_install(self, commit, version=None, python=None):
        """ Checkout or update the package to a given commit version.
        Install it with pip at this given revision.
        """
        channels = ' '.join(
            ['-c ' + channel for channel in self.conda_channels])
        pkg_path = (self.dir / self.name).abspath()
        if self.vcs == 'pypi':
            cmd = '%s %s==%s' % (self.cmd, self.name, commit)
        elif self.vcs == 'conda':
            cmd_list = [self.cmd]
            cmd_list.append(channels)

            cmd_list.append('%s=%s' % (self.name, commit))

            cmd = ' '.join(cmd_list)

        else:
            self.checkout_update(commit, version=version)
            cmd = '%s %s' % (self.cmd, pkg_path)

            if self.conda:
                cmd_list = [self.build_cmd]
                cmd_list.append(channels)
                cmd_list.append(self.recipe_dir)
                if python:
                    cmd_list.append('--python %s' % (python))
                build_cmd = ' '.join(cmd_list)

                logger.info('Build conda package: %s ' % (build_cmd))
                status = sh(build_cmd)
                if status:
                    return status

                _version = self.get_version(commit, version=version)
                cmd = 'conda install -y --use-local %s=%s' % (self.name,
                                                              _version)
                cmd = '%s -y %s %s=%s' % (self.cmd, channels, self.name,
                                          _version)

        status = sh(cmd)
        return status
예제 #6
0
    def clone(self):
        cwd = path('.').abspath()
        pp = self.dir/self.name
        if pp.exists():
            logger.info('%s directory already exists. We use this version' % pp)
            pp.chdir()
            if self.vcs == 'git':
                cmd = 'git fetch -p'
                sh(cmd)
                cmd = 'git pull origin master'
            elif self.vcs == 'svn':
                cmd = 'svn update'
            sh(cmd)
            cwd.chdir()

        elif self.vcs == 'pypi':
            pass
        else:
            if self.vcs == 'git':
                cmd = 'git clone %s %s' % (self.url, self.name)
            elif self.vcs == 'svn':
                cmd = 'svn checkout %s %s' % (self.url, self.name)

            self.dir.chdir()
            sh(cmd)
            cwd.chdir()
예제 #7
0
    def clone(self):
        cwd = path('.').abspath()
        pp = self.dir / self.name
        if pp.exists():
            logger.info('%s directory already exists. We use this version' %
                        pp)
            pp.chdir()
            if self.vcs == 'git':
                cmd = 'git fetch -p'
                sh(cmd)
                cmd = 'git pull origin master'
            elif self.vcs == 'svn':
                cmd = 'svn update'
            sh(cmd)
            cwd.chdir()

        elif self.vcs == 'pypi':
            pass
        else:
            if self.vcs == 'git':
                cmd = 'git clone %s %s' % (self.url, self.name)
            elif self.vcs == 'svn':
                cmd = 'svn checkout %s %s' % (self.url, self.name)

            self.dir.chdir()
            sh(cmd)
            cwd.chdir()
예제 #8
0
    def local_install(self, commit):
        """ Checkout or update the package to a given commit version.
        Install it with pip at this given revision.
        """
        pkg_path = (self.dir / self.name).abspath()
        if self.vcs == 'pypi':
            cmd = '%s %s==%s' % (self.cmd, self.name, commit)
        else:
            self.checkout_update(commit)
            cmd = '%s %s' % (self.cmd, pkg_path)

        status = sh(cmd)
        return status
예제 #9
0
    def local_install(self, commit):
        """ Checkout or update the package to a given commit version.
        Install it with pip at this given revision.
        """
        pkg_path = (self.dir / self.name).abspath()
        if self.vcs == 'pypi':
            cmd = '%s %s==%s' % (self.cmd, self.name, commit)
        else:
            self.checkout_update(commit)
            cmd = '%s %s' % (self.cmd, pkg_path)

        status = sh(cmd)
        return status
예제 #10
0
def run(cmd=None, error_file='error.txt', curdir=curdir):
    if cmd is None:
        cmd = 'ipython %s' % (curdir / 'test_adel.py')

    #sh('rm simple/*/*.pyc')
    status = sh(cmd)
    if path(error_file).exists():
        if liquidparser.knowcaller:
            return parse_error(error_file)
        else:
            path(error_file).move(curdir / 'errors' / error_file + str(count))
            return -1, -1
    else:
        return status
예제 #11
0
def run(cmd=None, error_file='error.txt', curdir=curdir):
    if cmd is None:
        cmd = 'ipython %s' % (curdir/'test_adel.py')

    #sh('rm simple/*/*.pyc')
    status = sh(cmd)
    if path(error_file).exists():
        if liquidparser.knowcaller:
            return parse_error(error_file)
        else:
            path(error_file).move(curdir/'errors'/error_file+str(count))
            return -1, -1
    else:
        return status
예제 #12
0
    def checkout_update(self, commit, version=None):
        pp = self.dir / self.name
        cwd = Path('.').abspath()

        commit = str(commit)

        if not pp.exists():
            logger.warning(
                'ERROR: %s has not been cloned (git) or checkout (svn).' %
                self.name)

        if self.vcs != 'path':  # When package is under svn or git
            pp.chdir()

            if self.vcs == 'svn':
                update_cmd = 'svn update -r %s' % commit
            elif self.vcs == 'git':
                update_cmd = 'git checkout %s' % commit
            else:
                raise Exception('%s is not implemented yet' % self.vcs)

            logger.info('Checkout %s: %s' % (self.name, update_cmd))

            status = sh(update_cmd)

            cwd.chdir()

        if self.conda:
            if self.vcs == 'git' and commit == 'master':
                return

            recipe_dir = self.recipe_dir
            conda_recipe_tpl = recipe_dir / 'meta.yaml.tpl'

            _version = self.get_version(commit, version=version)

            src = open(conda_recipe_tpl).read()
            src = Template(src)
            src = src.substitute(dict(version=_version))

            conda_recipe = recipe_dir / 'meta.yaml'

            f = open(conda_recipe, 'w')
            f.write(src)
            f.close()

            logger.info('Write %s from %s' % (conda_recipe, conda_recipe_tpl))

        return status
예제 #13
0
    def checkout_update(self, commit):
        pp = self.dir/self.name
        cwd = path('.').abspath()

        if not pp.exists():
            logger.warning('ERROR: %s has not been cloned (git) or checkout (svn).'%self.name)

        pp.chdir()
        commit = str(commit)

        if self.vcs == 'svn':
            update_cmd = 'svn update -r %s' % commit
        elif self.vcs == 'git':
            update_cmd = 'git checkout %s' % commit
        else:
            raise Exception('%s is not implemented yet' % self.vcs)

        status = sh(update_cmd)

        cwd.chdir()

        return status
예제 #14
0
    def checkout_update(self, commit):
        pp = self.dir / self.name
        cwd = path('.').abspath()

        if not pp.exists():
            logger.warning(
                'ERROR: %s has not been cloned (git) or checkout (svn).' %
                self.name)

        pp.chdir()
        commit = str(commit)

        if self.vcs == 'svn':
            update_cmd = 'svn update -r %s' % commit
        elif self.vcs == 'git':
            update_cmd = 'git checkout %s' % commit
        else:
            raise Exception('%s is not implemented yet' % self.vcs)

        status = sh(update_cmd)

        cwd.chdir()

        return status
예제 #15
0
    def clone(self):
        cwd = Path('.').abspath()

        if self.vcs == 'path':
            path_pkg = Path(self.url).abspath()

        pp = self.dir / self.name
        if self.vcs in ('pypi', 'conda'):
            pass
        elif pp.exists():
            logger.info('%s directory already exists. We use this version' %
                        pp)
            cmd = ''
            pp.chdir()
            if self.vcs == 'git':
                cmd = 'git fetch -p'
                sh(cmd)
                cmd = 'git pull origin master'
            elif self.vcs == 'svn':
                cmd = 'svn update'
            elif self.vcs == 'path':
                (pp / '..').chdir()
                pp.rmtree()

            sh(cmd)
            cwd.chdir()

        elif self.vcs in ('git', 'svn'):
            if self.vcs == 'git':
                cmd = 'git clone %s %s' % (self.url, self.name)
            elif self.vcs == 'svn':
                cmd = 'svn checkout %s %s' % (self.url, self.name)

            self.dir.chdir()
            sh(cmd)
            cwd.chdir()

        if self.vcs == 'path':
            # copy tree url into pp
            path_pkg.copytree(pp)