At 2014-05-25 12:21:05 +0100,
thepixel...@googlemail.com wrote:
>
> A few of them just proxy through to unix commands while others will
> use a Python API when it exists. Can someone explain the advantages
> and disadvantages for both?
I don't have a general answer, but I can illustrate one such difference
by something I ran into months ago.
I had a list of Debian package names, and I wanted to figure out which
packages in that list were not already installed; or, alternatively, to
find out if they were all up-to-date or not. This turns out to be clumsy
and slow to do using apt-get on the command line.
In contrast, with just a few lines of Python, I could use an apt.Cache()
to check cache[name].is_installed and cache[name].installed.version for
all my packages in a loop. It worked great.
> I'm writing a few modules and don't want to feel bad for writing a
> command proxy when I could spend time writing a python API for my
> needs.
My advice, for what it's worth, would be to do as much as you can by
running commands, and write more code only if a clear need presents
itself. (Oh, also: don't feel bad.)
-- ams