openSUSE Lizards

Authors
Adam Jurkiewicz
Adrian Schröter (5)
Agustin Chavarria (1)
Akhil Laddha
Alex Barrios
Alex Minton
Alexander Naumov
Alexander Orlovskyy (3)
Alexey Eromenko
Alin M Elena (4)
Andrea Florio (14)
Andreas Jaeger (44)
Andreas Stieger (1)
Andreas van dem Helge
Andrej Semen
Andrew Wafaa (25)
Arvin Schnell (6)
Beineri2
Bernhard Wiedemann
Bharath Acharya
Bonnie Kurniawan
Brian G. Merrell
Bruno Friedmann
Carl Fletcher
Casual Programmer
Chang ChiaChin
Christoph Thiel
Christopher Hobbs (15)
Ciaran Farrell (2)
Claes Backstrom
Coly Li
Cristian Rodríguez
Daniel Bornkessel
David Bailey
David C. Rankin
Dean Hilkewich
Dinar Valeev (5)
Dirk Müller (1)
Dmitry Serpokryl (7)
Duncan Mac-Vicar
Enrique Herrera Noya
Eugene Pivnev
FabioMux (1)
Federico Lucifredi
Frank Lee
Gabriele Mohr
Gerrit Beine
Helman Rene Taleno Martinez
Helmut Schaa
Henne (6)
Herbert Graeber
Holgi (2)
Hubert Mantel (1)
Ioan Vancea
J. Daniel Schmidt (1)
Jaime Andrés Vélez Osorio
James Tremblay (7)
Jan Blunck (4)
Jan Loeser (1)
Jan Madsen (1)
Jan Nieuwenhuizen
Jan-Christoph Bornschlegel (3)
Jan-Simon Möller (19)
Javier Llorente (2)
Jigish Gohil (22)
Jiri Srain (1)
Jiří Suchomel (1)
Johan Kotze (5)
John Terpstra
Joop Boonen
José Oramas
Josef Reidinger (8)
Juergen Weigert (1)
Julio Vannini (7)
Justin Haygood
Kálmán Kéménczy
Kayo Hamid
Kevin Yeaux (10)
Klaas Freitag (21)
Klara Cihlarova
Klaus Kämpf
Klaus Singvogel
kl_eisbaer (10)
Lars Marowsky-Bree
Li Bin
Ludwig Nussel (6)
M. Edward (Ed) Borasky
M. Edwin Zakaria
M. Hill
Manuel Trujillo
Marcos David
Marcus Hüwe (8)
Marcus Meissner (1)
Marcus Moeller (1)
Marcus Schaefer (3)
Martin Lasarsch (8)
Martin Mohring (8)
Martin Schmiderer
Martin Schmidkunz
Masim "Vavai" Sugianto (20)
Matt Sealey
Mauro Parra-Miranda
Michael Andres (1)
Michael Löffler (3)
Michael Skiba
Michal Marek (3)
Michal Vyskocil (9)
Michal Zugec
Miguel Angel Barajas Hernandez
Mingxi Wu
mrdocs
Nikanth Karthikesan (2)
Oprea Lucian
Oswin Zulu
Peter Nixon
Peter Pöml (4)
Petr Mladek (32)
Petr Uzel (2)
Philipp Thomas
Pragnesh Radadiya
Raul Libório
Ravi Kumar
Ray Chen
Ray Wang (1)
Renato de Pontes Pereira
Ricardo Chung
Ricardo Varas Santana (6)
Richard Bos (5)
Robert Lihm
Roland Haidl
Roman Drahtmueller
Rossana Motta (1)
Rupert Horstkötter (10)
Sascha Manns (45)
Savin Alex V.
Sebastian Schöbinger (4)
Stanislav Visnovsky (7)
Stefan Haas (1)
Stefan Hundhammer (5)
Stefan Schubert (3)
Steffen Winterfeldt (4)
Stephan Kulow (10)
Suman Manjunath
Suresh Jayaraman (1)
Susanne Oberhauser (2)
Syamsul Qamar Ngabito
Thomas Göttlicher (4)
Thomas Jones
Thomas Schraitle (15)
Thruth Wang
Tuukka (11)
Ulrich Hecht
Vincenzo Barranco
Wilken Gottwalt
Will Stephenson (1)
Xin Wei Hu
Yuri Tsarev





 

Developing with libyui/libzypp & python – part1

1 Star2 Stars3 Stars4 Stars5 Stars (11 votes, average: 4.27 out of 5)
Loading ... Loading ...
Sunday, September 14th, 2008 by Jan-Simon Möller Digg!

In a small series of posts I’ll describe some tips and tricks for developing with libyui and libzypp in python.
Thanks to the YaST developers and Klaus Kaempf, there are bindings to libyui the Yast User Interface library for python.
For libzypp there are also python-bindings done by Duncan Mac-Vicar Prett and Arvin Schnell.
Both are generated with the swig code generator and are not perfect yet, but as we’ll see they’re pretty usable.

One big problem we need to solve is: libyui and libzypp are part of your base-system/YaST. If we would update them in the main system,
we would probably screw up zypper and YaST – which is bad.
Therefore I compiled libyui and libzypp and all other needed packages with an custom –prefix (/opt/yuitest) inside the openSUSE Buildservice.
Thus we can easily install the latest version without breaking our system.

In this first part we’ll install and test libyui.

So lets start with adding the Buildservice repo:
For 11.0:
zypper ar -r http://download.opensuse.org/repositories/home:/dl9pf:/yuitest/openSUSE_11.0/home:dl9pf:yuitest.repo

For 10.3
zypper ar -r  http://download.opensuse.org/repositories/home:/dl9pf:/yuitest/openSUSE_10.3/home:dl9pf:yuitest.repo

Then refresh zypper:
zypper ref

Install the new packages:
zypper install po-python-yui prefix-opt-yast2-qt prefix-opt-yast2-ncurses

Now we have installed the new libraries in parallel under /opt/yuitest . But we need to make sure these libraries are used.
We need to set some environment variables – LD_LIBRARY_PATH and PYTHONPATH – before launching python.
To do this I created a bash wrapper “mypyhton” in ~/bin/ with the content:
For 32bit:
LD_LIBRARY_PATH=/opt/yuitest/lib/ PYTHONPATH=/opt/yuitest/lib/python2.5/site-packages/ python $@

For 64bit:
LD_LIBRARY_PATH=/opt/yuitest/lib64/ PYTHONPATH=/opt/yuitest/lib64/python2.5/site-packages/ python $@

So for easy cut’n'paste :
32bit:
cat << EOF > ~/bin/mypython
#!/bin/bash
LD_LIBRARY_PATH=/opt/yuitest/lib/ PYTHONPATH=/opt/yuitest/lib/python2.5/site-packages/ python \$@
EOF

64bit:
cat << EOF > ~/bin/mypython
#!/bin/bash
LD_LIBRARY_PATH=/opt/yuitest/lib64/ PYTHONPATH=/opt/yuitest/lib64/python2.5/site-packages/ python \$@
EOF

Not to forget:
chmod u+x ~/bin/mypython

Let’s test what we’ve done: download and run the first example code!

mkdir source
cd source
wget -nd "http://svn.opensuse.org/svn/yast/trunk/libyui-bindings/swig/python/examples/hello_world.py"
mypython hello_world.py

TADA ;) – you should see a QT GUI.

But libyui can do more – it even works on the console as you know yast works there.

export DISPLAY2=$DISPLAY  #save display
unset DISPLAY
mypython hello_world.py

Hey ;) , now you can see the blue console interface.

Let’s restore the DISPLAY variable for now …
export DISPLAY=$DISPLAY2

If you retry now, you’ll see the graphical UI again.

Next: Advanced libyui example and install of libzypp python-bindings.

My special thanks go to: Klaus Kaempf, Stefan Hundhammer, Michael Andres, Michael Matz, Martin Vidner, Duncan Mac-Vicar Prett and Arvin Schnell.

P.S.: The wallpaper can be found here.


2 Comments

Comment by Marek Stopka
2008-09-17 09:22:32

Totally off topic.. Where I can download that wallpaper? :-)

Comment by dl9pf
2008-09-17 09:32:25
 
 

Sorry, the comment form is closed at this time.