erikrose/peep — pull request #13 by erikrose (2013-08-28 23:07:44+00:00)
Title: Rework how peep downloads files and determines versions so we can tolera...

...te PEP-386-noncompliant package version numbers. Bump version to 0.4.

We've lifted the download loop out of pip: now we invoke pip --download once for each package. This gives us the opportunity to figure out which file the download resulted in and take apart its name to determine its version number--all without paying the IO penalty of unpacking the archive a second time. This unfortunately means introducing some redundant shell tokenization, but at least it's in the stdlib.

The upside is that we quite repeating what's essentially the same `for` loop in every function: it moves to `main`.

versions_of_downloads is out; version_of_archive is in. We no longer rely on package version numbers conforming to PEP 386. Sometimes they don't. version_of_archive absolutely insists on getting an answer and explodes if it doesn't. There's no more possibility of receiving an "x.y.z" punt in the output. There may be a corner case or two to plug in this function.

path_and_line gets lifted out to become requirements_path_and_line; it's now useful in 2 places.