schmir/pypiserver — pull request #36 by saltycrane (2013-04-02 00:41:00+00:00)
Title: Remove duplicates from "/simple" index page

The main line repo
(https://github.com/schmir/pypiserver/tree/c1b9386dff6db8f4486d83240d75b6c9c8fa5e1b)
currently lists duplicate entries on the "/simple" index page if the
package name contains hyphens and if both a source file and egg file are
uploaded. One index entry contains hyphens in the name which matches the
source file name and the other entry contains underscores in the name
which matches the egg file. Clicking both links lead to pages which list
the same files (both the source file and the egg file).

The previous fix
(https://github.com/saltycrane/pypiserver/commit/c6966afeeddec52c27e112472b9bf50fdea057ce)
mostly fixed this problem but it did not account for package names that
included an underscore. Change the "/simple" index to use the name from
a non-egg file, since this name should not have hyphens converted to
underscores as egg files do. If there are only egg files, use the egg
file name.

Some example packages that exhibit this behavior:

- MySQL-python
- Flask-Actions
- unittest-xml-reporting
- nose-exclude

We use your project at my company and my co-worker @andrewwatts is also interested in this issue. He suggested I re-open the issue citing that http://pypi.python.org/simple behaves this way. I noticed the original fix didn't properly handle names with underscores in their names, so I have re-worked the fix to handle this.