Tuesday, November 21, 2006

Create Debian package for a Python program

Note: You will need root access for the process.

  1. Install dh-make if it's not available in the system.
    apt-get dh-make

  2. Create a directory as -. Note that the package name must be all lower-case.
    eg: - mypackage-1.0

  3. Go inside that folder. Copy all your files into that. (including the setup.py)

  4. Create a Makefile with following contents.
    The reason is that unlike others, Debian uses the Makefile to read package information. We will create this file to be an intermediate between the Debian packager and out good old setup.py

    #### contents of Makefile ####

    all:
    python setup.py build
    clean:
    python setup.py clean --all
    install:
    python setup.py install --root $(DESTDIR)

    For more info about Makefile(s) see http://www.gnu.org/software/make/manual/

  5. Call the dh_make program.

    dh_make --single --createorig --copyright gpl --email my@email.com

    This tells the program to:
    1. Create a single class package.
    2. Create the original archive.
      (dh_make by default tries to convert the original archive of file to a .deb package. Here we ask it to create the original archive as well)
    3. State the copyrights of the package.
    4. email of the package maintainer. (Name of the maintainer is the username you have logged-in)

  6. It will create a folder called debian inside you current folder. Edit the control file inside the debian folder to reflect the dependencies and descriptions you want. Also edit the copyright file and fill in the missing info.

  7. Run the dpkg-buildpackage command as root.

  8. The root directory (not your package-version directory) will now have the .deb file

Monday, November 20, 2006

Mac OS X look on Ubuntu

http://www.taimila.com/ubuntuosx.php

Tuesday, November 14, 2006

Enable both .py and .psp in Apache2

  1. Install the mod_python module for Apache2

  2. Open the default file at /etc/apache2/sites-available/
    (Note that you will need super-user privileges for editing this)
       gedit /etc/apache2/sites-available/default

  3. Go to the section
    <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

    #Uncomment this directive is you want to see apache2's
    #default start page (in /apache2-default) when you go to /
    #RedirectMatch ^/$ /apache2-default/
    </Directory>
  4. Append this to the end of section
       AddHandler mod_python .py .psp
    PythonHandler mod_python.publisher|.py
    PythonHandler mod_python.psp|.psp
    PythonDebug On
    To read more about Apache directives, visit http://httpd.apache.org/docs/1.3/mod/mod_mime.html

  5. Restart Apache2:
    /etc/init.d/apache2 resart
  6. That's all folks!
    Now you can play with .py and .psp