Mercurial > hg > PaInt
view paint/pypi.py @ 61:1234bfb1f1f0
we really need to pick a canon
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 25 Jan 2013 10:34:19 -0800 |
parents | 59524b6d25c0 |
children |
line wrap: on
line source
""" functions for python package indices """ import os import pkginfo def pypi_path(path): """ returns subpath 2-tuple appropriate for pypi path structure: http://k0s.org/portfolio/pypi.html """ sdist = pkginfo.sdist.SDist(path) # determine the extension (XXX hacky) extensions = ('.tar.gz', '.zip', '.tar.bz2') for ext in extensions: if sdist.filename.endswith(ext): break else: raise Exception("Extension %s not found: %s" % (extensions, sdist.filename)) # get the filename destination filename = '%s-%s%s' % (sdist.name, sdist.version, ext) return sdist.name, filename