Mailinglist Archive: opensuse-buildservice (170 mails)

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

I'm writing some simple user helper scripts.
One of it need to do for example a
'osc copypac origproject package newproject'.

I did this with a function:

def obs_copypac(org, pkg, new):
cmdline = "osc copypac -e %s %s %s" % (org, pkg, new)
dbg_print( "cmdline: %s" % cmdline )
p = Popen(cmdline, shell=True, stdout=PIPE, stderr=PIPE)
(stdout, stderr) = p.communicate()
rc = p.returncode
dbg_print( "osc copypac output: %s" % stdout )
if rc:
print( osc copypac error: %s" % stderr
return rc


Works as expected. Then I remembered that osc itself was written in
Python as well, so it should be better to call the python stuff directly.

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)

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).

What do I missing here ?

Thanks
Karsten

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

< Previous Next >
List Navigation
Follow Ups