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
def info_list_name(self, name): req = Req(name) info_list = [] for key, info in self.query_remote(name=name): if req.matches(info): repo = self.remote.where_from(key) info['repo_dispname'] = repo.info()['dispname'] info_list.append(dict(info)) try: return sorted(info_list, key=lambda info: comparable_version(info['version'])) except TypeError: return info_list
def whats_new(enst): print FMT % ('Name', 'installed', 'available') print 60 * "=" inst = set(enst.get_installed_eggs()) something_new = False for egg_name in inst: if not dist_naming.is_valid_eggname(egg_name): continue in_n, in_v, in_b = dist_naming.split_eggname(egg_name) spec = enst.get_dist_meta(Req(in_n)) if spec is None: continue av_v = spec['version'] if (av_v != in_v and comparable_version(av_v) > comparable_version(in_v)): print FMT % (in_n, in_v, av_v) something_new = True if not something_new: print "no new version of any installed package is available"
def whats_new(c): fmt = '%-25s %-15s %s' print fmt % ('Name', 'installed', 'available') print 60 * "=" inst = set(egginst.get_installed()) something_new = False for egg_name in inst: if not dist_naming.is_valid_eggname(egg_name): continue in_n, in_v, in_b = dist_naming.split_eggname(egg_name) dist = c.get_dist(Req(in_n)) if dist is None: continue av_v = c.index[dist]['version'] if (av_v != in_v and comparable_version(av_v) > comparable_version(in_v)): print fmt % (in_n, in_v, av_v) something_new = True if not something_new: print "no new version of any installed package is available"
def whats_new(c): fmt = '%-25s %-15s %s' print fmt % ('Name', 'installed', 'available') print 60* "=" inst = set(egginst.get_installed()) something_new = False for egg_name in inst: if not dist_naming.is_valid_eggname(egg_name): continue in_n, in_v, in_b = dist_naming.split_eggname(egg_name) dist = c.get_dist(Req(in_n)) if dist is None: continue av_v = c.index[dist]['version'] if (av_v != in_v and comparable_version(av_v) > comparable_version(in_v)): print fmt % (in_n, in_v, av_v) something_new = True if not something_new: print "no new version of any installed package is available"
def calculate_all_patches(): egg_names = [fn for fn in os.listdir(eggs_dir) if is_valid_eggname(fn)] names = set(split_eggname(egg_name)[0] for egg_name in egg_names) for name in sorted(names, key=string.lower): versions = [] for egg_name in egg_names: n, v, b = split_eggname(egg_name) if n != name: continue versions.append((v, b)) versions.sort(key=(lambda vb: (comparable_version(vb[0]), vb[1]))) versions = ['%s-%d' % vb for vb in versions] lv = len(versions) #print name, lv, versions for i in xrange(0, lv): for j in xrange(i + 1, lv): yield '%s-%s--%s.zdiff' % (name, versions[i], versions[j])
def comparable_info(spec): """ Returns a tuple(version, build) for a distribution, version is a RationalVersion object. The result may be used for as a sort key. """ return comparable_version(spec['version']), spec['build']