Mailinglist Archive: opensuse-buildservice (142 mails)

< Previous Next >
Re: [opensuse-buildservice] calling osc from Python scripts
Hi Marcus,

Am 31.07.2013 14:24, schrieb Marcus Hüwe:
On 2013-07-31 13:22:42 +0200, Karsten Keil wrote:

<SNIP>

I looked at the osc-wrapper.py and was thinking that it should be easy
to do. Simple give the commandline.Osc() call the arguments for the osc
command like

osccli = commandline.Osc("copypac","-e", org, pkg, new)
r = babysitter.run(osccli)

The constructor parameters are not interpreted as a "command".


Ahh, yes I only guessed that because the constructor did have *args,
**kwargs, I did not looked deeper in the code.

But this does not work, it seems the arguments are ignored, I get always
the osc help page (same as running osc with no arguments).

Something like this should work:

from osc import commandline
cli = commandline.Osc()
cli.main(['osc', 'ls', 'home:Marcus_H'])


That satisfy my needs, thank a lot.

If needed I can also adjust the babysitter so that you can pass a
"command" to its "run" method.



For my application it's not needed, but in general it maybe a good idea
to have this option.

Karsten

--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-buildservice+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups