Wrap a function

Joan Miller peloko45 at gmail.com
Fri Jan 29 09:41:33 CET 2010

On 28 ene, 23:36, Jonathan Gardner <jgard... at jonathangardner.net>
> On Jan 28, 2:16 pm, Joan Miller <pelok... at gmail.com> wrote:
> > There would be to make a function for each system command to use so it
> > would be too inefficient, and follow the problem with the quotes.
> > The best is make a parser into a compiled language
> Yeah, you could do that. Or you can simply rely on /bin/sh to do the
> parsing and everything else for you. No need to re-invent the wheel. I
> don't think Python will ever beat sh as a shell replacement.
> When people say that Python is great for some situations, but not so
> much for others, I think they thought of running commands like this as
> "other",

I started to working on this project (Scripy [1]) because I wanted to
hacking cryptsetup in my ubuntu. The funcionts to manage its
initialization are in bash and it goes to be non-maintainable code,
cryptic and very hard to debug (as whatever bash script of medium
size). Here you have the beast:


Using Scripy I can debug easily the commands run from the shell, and
log all if I would.

Now, thanks to Scripy I've created a script for easily disks
partitioning [2] using a simple cofiguration in YAML [3]. The great
thing is that I can add volumes and encrypted partitions :)

The only problem is that it's too verbose but I could rename *run()*
by a simple function as *_()* or *r()*

[1] http://bitbucket.org/ares/scripy/src/
[2] http://bitbucket.org/ares/scripypartition/src/tip/lib/scripy/part/disk.py#cl-22
[3] http://bitbucket.org/ares/scripypartition/src/tip/bin/init_crypto.py#cl-46

More information about the Python-list mailing list