At 06:33 PM 5/15/2007 -0400, Jim Fulton wrote:
On May 15, 2007, at 1:48 PM, Phillip J. Eby wrote:
At 10:34 AM 5/12/2007 -0400, Jim Fulton wrote:
The local_open function in setuptools.package_index is used to open file URLs. A file URL pointing to a directory is treated as non found unless it ends in a "/". This seems overly restrictive to me. Would anyone object if the restriction was relaxed?
That restriction is so that the generated relative URLs work correctly. In order to relax that restriction, you'll need to change the generated URLs in the index, if a trailing / wasn't used. I just punted on that case to keep it simple, but feel free to patch it if you like (trunk and branch, of course).
I don't understand this. In particular, I don't understand why rejecting file URLs that point to directories but don't have trailing slashes makes relative URLs easier.
I propose to change:
if os.path.isfile(filename): return urllib2.urlopen(url) elif path.endswith('/') and os.path.isdir(filename):
in package_index.local_open to:
if os.path.isfile(filename): return urllib2.urlopen(url) elif os.path.isdir(filename):
I don't really understand how this would affect relative URLs.
The relative URLs that are in the HTML that local_open() returns will be broken if you do that.