Useful, robust shell utilities

Iñigo Serna inigoserna at terra.es
Mon Mar 4 07:43:14 EST 2002


Hello all,

El sáb, 02-03-2002 a las 02:57, Jonathan Gardner escribió:
> Donn Cave scribbled with his keyboard:
> 
> > Quoth Jonathan Gardner <jgardn at alumni.washington.edu>:
> > | I tried to use the shutil module... and to tell you the truth, it
> > | stinks. Is there an effort to make a robust, useful shutil module that
> > | has the equivalent of the unix shell utilities?

[...]
 
> It was just that the copytree function has this little comment:
> 
> The source code for this should be considered an example rather than a tool.
> 
> And it also won't copy to a directory that already exists... this is very 
> different than what 'cp' does.
>
> > | I think it would be nice to make things like 'grep' even...
> > |
> > | Here is my wish list. Each of these should implement a significant
> > | portion of what the GNU utils do. They should be robust, and give
> > | reasonable results, and reasonable exceptions.
> > |
> > | touch, chmod, chown, chgrp, touch
> > | df, du
> > | cp, dd, install, mv, rm, shred

in a program I'm developing (lfm, a mc clone (*)), I've had to write my
own functions/wrappers to many of these functions. Though it's not hard
to develop them for a concrete platform (posix OS) I think they are not
easily extensible to other platforms such as windows or Mac.

Finally, after thinking (and coding, and erasing, and coding) and
thinking, I chose a mix of os module functions, my own functions and
os.system() calls. I think this is the best solution. Moreover, a
shutil2 module wouldn't be exactly what you need, so you'll have to
modify/extend some functions to adequate to your needs always.

In most cases, my own functions are just wrappers that take data from
the curses ui which format properly to pass to os module functions.

Regards,
Iñigo


(*) http://www.terra.es/personal7/inigoserna/lfm
    NOTE: in a few days I'll release a new version of lfm.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 240 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20020304/fee29179/attachment.sig>


More information about the Python-list mailing list