Mercurial > hg > PaInt
comparison paint/pypi.py @ 29:59524b6d25c0
implementing making pypi directory strcuture from a package
| author | Jeff Hammel <jhammel@mozilla.com> | 
|---|---|
| date | Fri, 30 Mar 2012 11:41:04 -0700 | 
| parents | |
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 28:c44fb4b6918b | 29:59524b6d25c0 | 
|---|---|
| 1 """ | |
| 2 functions for python package indices | |
| 3 """ | |
| 4 | |
| 5 import os | |
| 6 import pkginfo | |
| 7 | |
| 8 def pypi_path(path): | |
| 9 """ | |
| 10 returns subpath 2-tuple appropriate for pypi path structure: | |
| 11 http://k0s.org/portfolio/pypi.html | |
| 12 """ | |
| 13 sdist = pkginfo.sdist.SDist(path) | |
| 14 | |
| 15 # determine the extension (XXX hacky) | |
| 16 extensions = ('.tar.gz', '.zip', '.tar.bz2') | |
| 17 for ext in extensions: | |
| 18 if sdist.filename.endswith(ext): | |
| 19 break | |
| 20 else: | |
| 21 raise Exception("Extension %s not found: %s" % (extensions, sdist.filename)) | |
| 22 | |
| 23 # get the filename destination | |
| 24 filename = '%s-%s%s' % (sdist.name, sdist.version, ext) | |
| 25 return sdist.name, filename | 
