[Distutils] easy_install ./mymodule.py
Phillip J. Eby
pje at telecommunity.com
Mon Mar 13 16:17:57 CET 2006
At 09:21 AM 3/13/2006 +0000, Fuzzyman wrote:
>Ville Vainio wrote:
>>On 3/13/06, Phillip J. Eby
>><mailto:pje at telecommunity.com><pje at telecommunity.com> wrote:
>>>If you do this:
>>> easy_install "http://somesite.com/mymodule.py#egg=MyProject-0.1"
>>>EasyInstall will treat the .py file as being an egg named MyProject, with a
>>>version number of 0.1.
>>Ok, thanks for the pointer. However, would it perhaps make sense to
>>have the option of automatically generating the egg name from the
>>module name (and using the name 'Mymodule", for example).
>It looks like setuptools determines the name of the file from the URL.
>I use a Python CGI to serve my files for download. This means that anyone
>Gets an egg containing 'downman.py'. The CGI does send the correct http
>header containing the filename :
> Content-Type: application/octet-stream
> Content-Disposition: attachment; filename= "%s"
> Content-Length: %s
>Shouldn't setuptools honour the "Content-Disposition" header ?
EasyInstall has to determine the project name and version from the URL,
because otherwise it has no way to know *which* URL to download (in the
case where it's scanning pages for links.
If you need it to deal with URLs like the one you gave above, you'll need
to use the "#egg=Projectname-Version" suffix on the URL.
Now, if you mean that when you *do* use that approach, you end up with the
wrong filename for the .py, I suppose you have a point.
OTOH, why not just change your downman.py to use PATH_INFO? e.g.:
I don't process Content-Disposition because currently the choice of
filename has to be fixed before the download begins. Changing it would
only be useful for the "single .py file" case, because in all other
situations the downloaded filename doesn't matter; only the info that was
gotten from the URL. But it seems odd to support weird download options
for single .py files; why not just put the file directly on the server and
be done with it?
More information about the Distutils-SIG