[Distutils] Overly picky about file URLs
Jim Fulton
jim at zope.com
Wed May 16 00:33:35 CEST 2007
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.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Distutils-SIG
mailing list