예제 #1
0
    def get_status(self):
        if not self._status:
            # the result is a dict mapping cname to ...
            res = {}
            for cname in self.get_installed_cnames():
                d = defaultdict(str)
                info = self.enst.get_installed_info(cname)[0][1]
                if info is None:
                    continue
                d.update(info)
                res[cname] = d

            for cname in self.enst.chain.groups.iterkeys():
                dist = self.enst.chain.get_dist(Req(cname),
                                                allow_unsubscribed=True)
                if dist is None:
                    continue
                repo, fn = dist_naming.split_dist(dist)
                n, v, b = dist_naming.split_eggname(fn)
                if cname not in res:
                    d = defaultdict(str)
                    d['name'] = d.get('name', cname)
                    res[cname] = d
                res[cname]['a-egg'] = fn
                res[cname]['a-ver'] = '%s-%d' % (v, b)

            def vb_egg(fn):
                try:
                    n, v, b = dist_naming.split_eggname(fn)
                    return comparable_version(v), b
                except IrrationalVersionError:
                    return None
                except AssertionError:
                    return None

            for d in res.itervalues():
                if d['egg_name']:                    # installed
                    if d['a-egg']:
                        if vb_egg(d['egg_name']) >= vb_egg(d['a-egg']):
                            d['status'] = 'up-to-date'
                        else:
                            d['status'] = 'updateable'
                    else:
                        d['status'] = 'installed'
                else:                                # not installed
                    if d['a-egg']:
                        d['status'] = 'installable'
            self._status = res
        return self._status
예제 #2
0
파일: main.py 프로젝트: ninalinzhiyun/VB3
def egginst_install(conf, dist):
    repo, fn = dist_naming.split_dist(dist)
    pkg_path = join(conf['local'], fn)

    pprint_fn_action(fn, 'installing')
    if dry_run:
        return

    ei = egginst.EggInst(pkg_path)
    ei.install()
    info = get_installed_info(cname_fn(fn))
    path = join(info['meta_dir'], '__enpkg__.txt')
    fo = open(path, 'w')
    fo.write("repo = %r\n" % repo)
    fo.close()
예제 #3
0
파일: main.py 프로젝트: ilanschnell/ironpkg
def egginst_install(conf, dist):
    repo, fn = dist_naming.split_dist(dist)
    pkg_path = join(conf['local'], fn)

    pprint_fn_action(fn, 'installing')
    if dry_run:
        return

    ei = egginst.EggInst(pkg_path)
    ei.install()
    info = get_installed_info(cname_fn(fn))
    path = join(info['meta_dir'], '__enpkg__.txt')
    fo = open(path, 'w')
    fo.write("repo = %r\n" % repo)
    fo.close()
예제 #4
0
    def get_status(self):
        if not self._status:
            # the result is a dict mapping cname to ...
            res = {}
            for cname in self.get_installed_cnames():
                d = defaultdict(str)
                info = self.enst.get_installed_info(cname)[0][1]
                if info is None:
                    continue
                d.update(info)
                res[cname] = d

                for cname in self.enst.chain.groups.iterkeys():
                    dist = self.enst.chain.get_dist(Req(cname))
                    if dist is None:
                        continue
                    repo, fn = dist_naming.split_dist(dist)
                    n, v, b = dist_naming.split_eggname(fn)
                    if cname not in res:
                        d = defaultdict(str)
                        d["name"] = d.get("name", cname)
                        res[cname] = d
                    res[cname]["a-egg"] = fn
                    res[cname]["a-ver"] = "%s-%d" % (v, b)

            def vb_egg(fn):
                try:
                    n, v, b = dist_naming.split_eggname(fn)
                    return comparable_version(v), b
                except IrrationalVersionError:
                    return None
                except AssertionError:
                    return None

            for d in res.itervalues():
                if d["egg_name"]:  # installed
                    if d["a-egg"]:
                        if vb_egg(d["egg_name"]) >= vb_egg(d["a-egg"]):
                            d["status"] = "up-to-date"
                        else:
                            d["status"] = "updateable"
                    else:
                        d["status"] = "installed"
                else:  # not installed
                    if d["a-egg"]:
                        d["status"] = "installable"
            self._status = res
        return self._status