Ejemplo n.º 1
0
    def test_split_dist(self):
        for repo, fn in [
            ('http://www.example.com/repo/', 'foo.egg'),
            ('file:///home/repo/', 'numpy-1.1.1-5.egg'),
            ('file://E:\\eggs\\', 'numpy-1.1.1-5.egg'),
            ('file://C:\\Desk and Top\\', 'with space.egg'),
            ]:
            dist = repo + fn
            self.assertEqual(dist_naming.split_dist(dist), (repo, fn))

        for dist in ['local:/foo.egg', '', 'foo.egg', 'file:///usr/']:
            self.assertRaises(AssertionError, dist_naming.split_dist, dist)
Ejemplo n.º 2
0
    def test_split_dist(self):
        for repo, fn in [
            ('http://www.example.com/repo/', 'foo.egg'),
            ('https://www.example.com/repo/', 'foo.egg'),
            ('file:///home/repo/', 'numpy-1.1.1-5.egg'),
            ('file://E:\\eggs\\', 'numpy-1.1.1-5.egg'),
            ('file://C:\\Desk and Top\\', 'with space.egg'),
        ]:
            dist = repo + fn
            self.assertEqual(dist_naming.split_dist(dist), (repo, fn))

        for dist in ['local:/foo.egg', '', 'foo.egg', 'file:///usr/']:
            self.assertRaises(AssertionError, dist_naming.split_dist, dist)
Ejemplo n.º 3
0
def get_status():
    # the result is a dict mapping cname to ...
    res = {}
    for cname in egginst.get_installed_cnames(sys.prefix):
        d = defaultdict(str)
        info = get_installed_info(sys.prefix, cname)
        if info is None:
            continue
        d.update(info)
        res[cname] = d

    c = Chain(config.get('IndexedRepos'))

    for cname in c.groups.iterkeys():
        dist = c.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'] = n
            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:
            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'
    return res
Ejemplo n.º 4
0
def get_status():
    # the result is a dict mapping cname to ...
    res = {}
    for cname in egginst.get_installed_cnames(sys.prefix):
        d = defaultdict(str)
        info = get_installed_info(sys.prefix, cname)
        if info is None:
            continue
        d.update(info)
        res[cname] = d

    c = Chain(config.get('IndexedRepos'))

    for cname in c.groups.iterkeys():
        dist = c.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'] = n
            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:
            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'
    return res