[Python-ideas] Python as a tool to download stuff for bootstrapping
anatoly techtonik
techtonik at gmail.com
Mon Oct 15 13:13:56 CEST 2012
On Fri, Jul 6, 2012 at 10:30 PM, Georg Brandl <g.brandl at gmx.net> wrote:
> On 05.07.2012 22:24, Amaury Forgeot d'Arc wrote:
>>
>> 2012/7/5 anatoly techtonik <techtonik at gmail.com>:
>>>
>>> This makes me kind of sad. You have Python installed. Why can't you
>>> just crossplatformly do:
>>>
>>> mkdir nacl
>>> cd nacl
>>> python -m urllib get
>>>
>>> http://commondatastorage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/update_sdk.py
>>> python update_sdk.py
>>
>>
>> I'm sure there is already a way with standard python tools. Something
>> along these lines:
>>
>> python -c "from urllib.request import urlretrieve; urlretrieve('URL',
>> 'update_sdk.zip')"
>> python -m update_sdk.zip
>>
>> The second command will work if the zip file has a __main__.py.
>> Do you think we need other tools?
>
>
> The "python -m urllib" (don't think "get" is required) interface certainly
> looks nice and is similar in style with many of the other __main__ stuff we
> add to stdlib modules.
Here is the implementation of urllib.__main__ module for Python 3 with
progress bar. I've left 'get' argument to make it extensible in future with
other commands, such as `test`.
While working on this code I've also found the regression which would
be nice to see fixed at the same time.
http://bugs.python.org/issue10836
-------------- next part --------------
A non-text attachment was scrubbed...
Name: __main__.py
Type: application/octet-stream
Size: 4783 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121015/0fcbf81b/attachment.obj>
More information about the Python-ideas
mailing list