Skip to content

pyjamasubuntuwebkitgtk

DiThi edited this page Nov 14, 2012 · 5 revisions

Installing pyjs and pyjs Desktop on Ubuntu

Introduction

This page explains how to install and run pyjs and pyjs Desktop with WebKitGTK on Ubuntu (11.10).

Getting And Building pyjs

$ git clone https://github.com/pyjs/pyjs.git

This should create a directory pyjs/ containing the current development source code.

Run bootstrap.py to create the bin/ directory, containing wrapper programs necessary to compile pyjs applications, and also to create the file pyjd/__init__.py for pyjs Desktop integration:

$ cd pyjs
pyjs$ python bootstrap.py 

It is useful to add the bin/ directory to your PATH variable (and/or to ~/.bashrc), for example:

pyjs$ export PATH=`pwd`/bin:$PATH

Testing pyjs

A first test can be done now:

pyjs$ cd examples/helloworld/
pyjs/examples/helloworld$ ./build.sh Hello.py

This generates a directory output/ containing Hello.html and a lot of other files and directories.

Now you can open output/Hello.html in firefox:

pyjs/examples/helloworld$ firefox output/Hello.html

Now go back to the pyjs/ root directory for the next step:

pyjs/examples/helloworld$ cd ../..

Setting Up pyjs Desktop: Webkit

Note

pythonwebkit doesn't support Canvas applications. If you intend to run an app that uses Canvas, instead try xulrunner.

Detailed instructions are available at http://www.gnu.org/software/pythonwebkit/

Install libwebkit for it's dependencies, and then remove it:

sudo apt-get build-dep libwebkit-dev
sudo apt-get install libwebkit-dev
sudo apt-get remove libwebkit-dev

Other required packages:

sudo apt-get install build-essential
sudo apt-get install python-dev python-ply python-gtk2-dev
sudo apt-get install gnome-common gtk-doc-tools libxml2-dev

Get the pythonwebkit code:

git clone --depth 1 git://git.savannah.gnu.org/pythonwebkit.git
cd pythonwebkit
git checkout -b python_codegen

Compile the sources:

mkdir build
cd build
../autogen.sh
../configure

make
sudo make install
cd ../..

Update the shared libraries:

sudo ldconfig

Quick sanity check that python can import pywebkitgkt:

python
>>> import pywebkitgtk
>>>

If there is a problem here it may be helpful to check /etc/ld.so.conf to ensure it contains /usr/local/lib, and also to run ldconfig -p to double-check that the python webkit library is listed. Also consider doing ldd /usr/local/lib/libwebkitgtk-python-1.0.so.0 and double-check that the library can find all its runtime libs.

Create the pyjdrc file:

mkdir ~/.pyjd
vi ~/.pyjd/pyjdrc

Save the following 2 lines in ~/.pyjd/pyjdrc:

[gui]
engine:pywebkitgtk

Setup pyjs:

cd pyjs
python run_bootstrap_first_then_setup.py build
sudo python run_bootstrap_first_then_setup.py install

Finally, test the Mail application using pyjs Desktop:

cd examples/mail
../../bin/pyjd Mail.py

Running The Test Suite

In pyjs/examples/libtest, follow the README.

See also