Mailinglist Archive: yast-devel (251 mails)

< Previous Next >
Re: [yast-devel] Re: YaST bindings for Python3?
  • From: "Duncan Mac-Vicar P." <dmacvicar@xxxxxxx>
  • Date: Mon, 15 Jul 2013 10:35:26 +0200
  • Message-id: <51E3B44E.8050608@suse.de>
On 13/07/13 23:57, Christian Boltz wrote:
Hello,

Am Freitag, 12. Juli 2013 schrieb Josef Reidinger:
at first congratulation to look at our python bindings. I expect that
you see there a lot of sharp edges. In fact, now there is no
maintainer for python bindings, so if you want to take care of it, I
would welcome it. I can help you with understanding how it works from
liby2 side ( y2 is component system to which is bindings attached ).

I know YaST2 mostly from a user's POV (and nearly nothing about
its libraries and bindings), but nevertheless I'd like to ask a
(maybe silly) question ;-)

For libapparmor, we are using swig to auto-generate the python (and
other) bindings. This works with very few lines of code.

In comparison, the code for the YaST python bindings is quite big, which
also means more maintenance is required.

SWIG is meant to bind C/C++ code. YaST bindings are a multilanguage
hub/broker.

YaST bindings are more of bindings against the YCP type system, for
example with the perl, ruby and python bindings you can write code in
perl, ruby or python that call functions implemented in perl, ruby,
python, the ycp language or plain c++.

A SWIG binding scans a .h file and generates the interpreter glue code
for that API.

There is no static API for YaST bindings. They are found at runtime
scanning installed YaST modules in any language.

Workflow is like this (simplified, it is actually a bit more sophisticated):

<from some language, eg. python>
import YCP
(loads the YCP/YaST bindings)
LAN = YCP.import("LAN")
LAN.autoConfigureNetwork("eth0")

YCP is a python module coded in C, that uses the YaST C++ API. That
YCP.import call will from the YaST C++ code:
- query all others bindings. Ask them whether they have a LAN module in
their own language.
- For the binding that answer yes (imagine: Perl binding found LAN.pm)
- marshall the autoConfigureNetwork call and arguments to the YCP type
system.
- Call the module using the YaST APIs (component broker)
- The perl binding will get the call, it will unmarshall the YCP
objects, convert them to perl types and call autoConfigureNetwork in the
LAN.pm module.

Duncan




--
Duncan Mac-Vicar P. - http://www.suse.com/

SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix
Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >