• Kirill Smelkov's avatar
    One name might refer to both an egg and a C library · 98687ba0
    Kirill Smelkov authored
    This happens for real with msgpack egg / C-library.
    
    -> Fix handling of such situation via using (name, kind) instead of only
    name as BOM key. Without the fix added test breaks as
    
        def addbom(urlpath, kind, version=None):
            name, ver = namever(urlpath)
            if version is not None:
                assert ver is None
                ver = version
            ver = removeprefix(ver, name+'-')   # wendelin.core-2.0.alpha3-0-g6315384  -> 2.0.alpha3-0-g6315384
            if '//' in urlpath:
                url = urlpath
            else:
                if kind == 'egg':
                    # XXX not strictly correct -> better retrieve the actual URL, but buildout does not save it in installed.cfg
                    url = 'https://pypi.org/project/%s/%s/' % (name, ver)
                else:
                    raise NotImplementedError('TODO url for kind %r  (urlpath: %r)' % (kind, urlpath))
    
            info = PkgInfo(name, ver, kind, url)
            if name in bom:
    >           assert bom[name] == info,  (bom[name], info)
    E           AssertionError: (PkgInfo(name='msgpack', version='0.5.4', kind='', url='http://downloads.sourceforge.net/project/msgpack/msgpack/cpp/msgpack-0.5.4.tar.gz'), PkgInfo(name='msgpack', version='0.6.2', kind='egg', url='https://pypi.org/project/msgpack/0.6.2/'))
    98687ba0
nxdbom_test.py 9.39 KB