def add_Reqs_to_spec(spec): """ add the 'Reqs' key (which maps to the set of requirement objects), as well as the 'cname' key, to a spec dictionary """ spec['Reqs'] = set(Req(s) for s in spec['packages']) spec['cname'] = canonical(spec['name'])
def test_canonical(self): for name, cname in [ ('NumPy', 'numpy'), ('MySql-python', 'mysql_python'), ('Python-dateutil', 'python_dateutil'), ]: self.assertEqual(canonical(name), cname)
def add_Reqs_to_spec(spec): """ Add the 'Reqs' key, which maps to a set of requirement objects, to a spec dictionary. """ spec['cname'] = canonical(spec['name']) spec['Reqs'] = set(Req(s) for s in spec['packages'])
def test_naming(self): for fn, name, ver, cname in [ ('NumPy-1.5-py2.6-win32.egg', 'NumPy', '1.5-py2.6-win32', 'numpy'), ('NumPy-1.5-2.egg', 'NumPy', '1.5-2', 'numpy'), ('NumPy-1.5.egg', 'NumPy', '1.5', 'numpy'), ]: self.assertEqual(name_version_fn(fn), (name, ver)) self.assertEqual(name.lower(), cname) self.assertEqual(canonical(name), cname)
def __init__(self, req_string): for c in '<>=,': assert c not in req_string, req_string lst = req_string.split() assert len(lst) <= 2, req_string self.strictness = 0 self.name = self.version = self.build = None if lst: self.name = canonical(lst[0]) self.strictness = 1 if len(lst) == 2: tmp = lst[1] self.version = tmp.split('-')[0] self.strictness = 2 + bool('-' in tmp) if self.strictness == 3: self.build = int(tmp.split('-')[1])