Wednesday, December 15, 2010

Compile and install PyQt4 for python2.7 in Ubuntu.

This tutorial shows how to build and install PyQt4 with python2.7 in Ubuntu.

If you want to use it with different version of python than 2.7 than replace every 2.7 in instructions below with the version you are using and it should work (tested with 2.6 and 3).

First, you need some prerequities:
sudo apt-get install python-pip python2.7-dev libxext-dev python-qt4 qt4-dev-tools build-essential

Then, try to install the PyQt and SIP using pip (it fails but it downloads the required packages to your ~/build/ folder).
pip install PyQt
pip install SIP

After that go to ~/build/SIP and install it
cd ~/build/SIP
python2.7 configure.py
make
sudo make install


Finally go to ~/build/PyQt and install it
Note: as PyQt is a big project - building it may take some time..
cd ~/build/PyQt
python2.7 configure.py
make
sudo make install


And that's all. You can test it by trying to import QtCore in python2.7
python2.7
>>> from PyQt4 import QtCore, QtGui


If there is no import error - you have PyQt4 installed correctly!

Monday, December 13, 2010

SSH tunneling to access svn repository hidden behind a firewall.

Let's assume you have a repository link like:

https://<repositoryhost>/<reponame>

and you cannot access the <repositoryhost> directly but you can access the <repositoryhost> from the <proxyhost>

On the client's machine do:

ssh -Nf -L443:<repositoryhost>:443 <username>@<proxyhost>

The -Nf is optional - but it forces ssh to not create an interactive session but only do the port forwarding.

Then you can check out you repository using:

svn co https://localhost/<reponame>

If your repository link doesn't start with https:// you need to change 443 to another port number when doing the ssh.

Default ports by protocol:
  • https:// port 443
  • svn:// port 3980
  • http:// port 80
  • ssh+svn:// port 22