Friday, October 29, 2010

Windows users, your turn

now that you have instructions on how to build installer and portable versions of emesene 2, I expect the best and most tested installer available in short time.

you asked for it, now you have it, make windows a first class citizen for emesene 2.

test it, fix the problems and provide up to date versions of emesene for your platform.

linux, *BSD users: what are you waiting to document how to package for your distro of choice and be at the level of windows?

if you have the steps documented, contact me so we can add them to the emesene repo and keep the updated versions where users can see them.

happy packaging!

Como generar archivos .exe e instaladores para una aplicación python (y pygtk)

Como generar archivos .exe e instaladores para una aplicación python


Este documento describe los pasos necesarios para crear un archivo ejecutable
de una aplicación python y como generar un instalador y una versión portable
para dicha instalación.

Este documento asume que la aplicación se basa en GTK pero debería funcionar
con menores cambios en otros toolkits.

porque un instalador

  • se requiere instalar muchos componentes a mano por el usuario final para una sola aplicación
  • muchos instaladores pequeños
  • difíciles de encontrar
  • difícil encontrar las versiones exactas que funcionan en conjunto
  • requiere instalarlos en un orden definido
  • rezar
  • algunas veces incluso haciendo todo bien puede no funcionar
  • fácil de automatizar y documentar para replicar con cada nueva versión
  • liberar al usuario final de los problemas para poder usar la aplicación

componentes requeridos

  • python
  • todas las librerías utilizadas por la aplicación
  • py2exe
  • nsis
  • tiempo y suerte

orden de instalación

algunos instaladores son independientes de otros, pero para evitar posibles problemas recomiendo la instalación en el siguiente orden.

  • python
  • gtk-runtime
  • gtk2-themes
  • nsis
  • pygobject
  • pycairo
  • pygtk
  • pywin32
  • py2exe

tareas extra

  • setear la variable de entorno PATH para agregar el path a la instalación de python
  • probar la instalación con una pequeña aplicación gtk
>>> import gtk
>>> w = gtk.Window()
>>> l = gtk.Label("asd")
>>> w.add(l)
>>> w.show_all()
>>> gtk.main()

prueba con una aplicación de ejemplo

Cree un repositorio con una aplicación de ejemplo para probar los pasos, la aplicación esta disponible en github acá:

http://github.com/marianoguerra/PyGtkOnWindows

pasos

  • descargarla
  • descomprimirla
  • ejecutar python setup.py py2exe
  • copiar los directorios lib y share de la instalación del runtime de gtk (no de la instalación de pygtk) al directorio dist
  • copiar todos los archivos del directorio dll al directorio dist
  • borrar los locales y temas no usados de los directorios copiados a dist (yo solo dejo el theme MS-Windows)
  • crear la siguiente estructura de directorios dentro de dist: etc/gtk-2.0
  • dentro de ese directorio crear un archivo llamado gtkrc con una linea como la siguiente dentro:
    • gtk-theme-name = "MS-Windows"
    • podes cambiar el tema usado manteniendo otro theme dentro de share/themes y cambiando el nombre del theme en gtkrc
  • right click en ejemplo.nsi y seleccionar "Compile NSIS Script"
  • right click en ejemplo-portable.nsi y seleccionar "Compile NSIS Script"
  • deberías tener el instalador y la versión portable disponibles
  • para probar que funciona correctamente, correr el instalador y la versión portable en una instalación de windows sin los paquetes que instalaste anteriormente

probar con una aplicación real

ahora para sentirlo mas real, creemos un instalador y una versión portable de
un programa real, en este caso, un proyecto personal llamado emesene 2
(http://www.emesene.org/).

pasos

  • descargarlo de http://github.com/emesene/emesene
  • descomprimirlo
  • copiar setup.py and ez_setup.py al directorio emesene
  • cd emesene
  • correr python setup.py py2exe
  • cd ..
  • copiar los directorios lib y share de la instalación del runtime de gtk (no de la instalación de pygtk) al directorio dist
  • copiar todos los archivos del directorio dll al directorio dist
  • borrar los locales y temas no usados de los directorios copiados a dist (yo solo dejo el theme MS-Windows)
  • crear la siguiente estructura de directorios dentro de dist: etc/gtk-2.0
  • dentro de ese directorio crear un archivo llamado gtkrc con una linea como la siguiente dentro:
    • gtk-theme-name = "MS-Windows"
    • podes cambiar el tema usado manteniendo otro theme dentro de share/themes y cambiando el nombre del theme en gtkrc
  • right click en emesene.nsi y seleccionar "Compile NSIS Script"
  • right click en emesene-portable.nsi y seleccionar "Compile NSIS Script"
  • deberías tener el instalador y la versión portable disponibles
  • para probar que funciona correctamente, correr el instalador y la versión portable en una instalación de windows sin los paquetes que instalaste anteriormente

notas

How to generate .exe files and installers for a python (and pygtk) applications

How to generate .exe files and installers for a python applications


This document describes the steps required to create an executable file from a
python program and how to build an installer and portable file from that
application.


The document assumes that the application is based on GTK but it should work
with minor changes for other toolkits.

why an installer

  • many components are required to install by hand by the end user for a simple application
  • a lot of small installers
  • hard to find
  • hard to match the exact versions that work together
  • install them in the required order
  • pray
  • sometimes even doing everything right it may not work
  • easy to automate and document to replicate with each new version
  • free the end user from problems to use the app

required components

  • python
  • all the libraries used by the application
  • py2exe
  • nsis
  • time and luck ;)

installation order


some installers are independent from the others, but to avoid posible problems I recommend the installation in this order.

  • python
  • gtk-runtime
  • gtk2-themes
  • nsis
  • pygobject
  • pycairo
  • pygtk
  • pywin32
  • py2exe

extra tasks

  • set the PATH environment variable to add the path to the python installation
  • test that the installation works with a simple gtk application
>>> import gtk

>>> w = gtk.Window()
>>> l = gtk.Label("asd")
>>> w.add(l)
>>> w.show_all()
>>> gtk.main()

test with a sample application


I created a repository with a sample application to test the steps, the application is available in github here:

http://github.com/marianoguerra/PyGtkOnWindows

steps

  • download it
  • unpack it
  • run python setup.py py2exe
  • copy the lib and share directory from the gtk runtime installation (not the pygtk installation) to the dist directory
  • copy all the files from the dll directory to the dist directory
  • remove unused locales and unused themes (I keep only ms theme)
  • create the following dirs inside dist: etc/gtk-2.0
  • inside that create a file called gtkrc with a line like this inside:
    • gtk-theme-name = "MS-Windows"
    • you can change the theme by keeping that theme inside share/themes and changing the name in gtkrc
  • right click on ejemplo.nsi and select "Compile NSIS Script"
  • right click on ejemplo-portable.nsi and select "Compile NSIS Script"
  • you should have the installer and portable versions available
  • to test that it works correctly, run the installer and portable versions in a windows installation without the packages you installed previously

test with a real application

now to make it feel more real let's create an installer and portable versions
for a real world program, in this case, a project of mine called emesene 2
(http://www.emesene.org/).

steps


  • download it from http://github.com/emesene/emesene
  • unpack it
  • copy setup.py and ez_setup.py to the emesene directory
  • cd to emesene
  • run python setup.py py2exe
  • cd ..
  • copy the lib and share directory from the gtk runtime installation (not the pygtk installation) to the dist directory
  • copy all the files from the dll directory to the dist directory
  • remove unused locales and unused themes (I keep only ms theme)
  • create the following dirs inside dist: etc/gtk-2.0
  • inside that create a file called gtkrc with a line like this inside:
    • gtk-theme-name = "MS-Windows"
    • you can change the theme by keeping that theme inside share/themes and changing the name in gtkrc
  • right click on emesene.nsi and select "Compile NSIS Script"
  • right click on emesene-portable.nsi and select "Compile NSIS Script"
  • you should have the installer and portable versions available
  • to test that it works correctly, run the installer and portable versions in a windows installation without the packages you installed previously

notes

Monday, October 25, 2010

it's coming

emesene 2 on windows :D

right now I have the installer and portable versions available, I need to test them some more.

if you really want to test it, follow the instructions in INSTALL_WINDOWS.txt and become the windows mantainer ;).



Sunday, October 24, 2010

maybe I forgot, where to report bugs/problems/requests

I think I never mentioned where to report bugs, problems or request features.

we are using the issue tracker of github:

http://github.com/emesene/emesene/issues

please check that your issue isn't already reported by someone else.

if you want to help us you could try to solve some of the issues.

instructions for testers

first of all a warning: the ppa is currently outdated in relation to the git repository, if you want to test you will have to use the git repo, below are instructions on how to do it.

if someone can help us setting up a daily updated ppa it would be great!

how to get the latest version of emesene 2 from git:

first install git (instruction for debian based distros here)

sudo apt-get install git-core

clone emesene 2 from git


git clone http://github.com/emesene/emesene.git


init and update submodules


cd emesene
git submodule init
git submodule update

from time to time update from the repo

git pull origin master
git submodule update

with that you should have the latest development version and updated when you need it.

to run do

cd emesene
./emesene

happy usage!

qt frontend and problems connecting

hi, lot of people seem to have problems connection with papyon backend in emesene 2.

if you have this problems try selecting the e3.msn session in the login window clicking the preference button that is at the bottom right corner of the window. Or you can also use it with gtalk or facebook (a little more experimental backends).

I would also like to introduce a new sub project inside emesene 2, Whisky84 started working on a qt4 frontend for emesene 2, the code is located here: http://github.com/Whisky84/emesene

warning, this is in heavy development, only try it if you are a developer and want to help him

thanks to Whisky84!

the message I saw yesterday is that we need testers, yes we need them but we also really need developers to help us, so run that message too!

thanks all of the people that helped since yesterday!

Saturday, October 23, 2010

we need a release and we need it now, and we need help!

with some time to use on my projects I decided to give emesene 2 a renewed push to try to make it deserve the label of beta.

I started fixing issues, closing duplicated, confusing or out of date issues and I only was left with feature requests and papyon bugs. That means two things:

  • emesene 2 is pretty stable
  • and/or nobody is using it
that means that we need users using it and since emesene 1.x is in maintainance only mode, we need to start moving users and developers to emesene 2. This means that you, your friends and your cat should be using/testing/developing emesene 2. I think that if we don't make the transition to emesene 2 both emesene 1 and 2 will stall and go the way of the dodo.


this is a call for action, start spreading the word, looking for users/testers/developers/packagers


we need all of those and more important we need developers and packagers to get to the release of emesene 2.


at this point emesene 2 is at feature parity with what was the emesene 1.0 release and it is more customizable, extensible and stable than emesene 1.0 was on the release date.

what I'm trying to say? if we keep waiting for emesene 2 to pass the features of emesene 1.6.3 we will never make a release. It's time to focus on the core features and stabilize. Later with a stable release people will start to help with fixes, plugins and extensions but a forever alpha doesn't help nobody.

since yesterday was capslock day I will say it like it deserves to be said

WE NEED HELP NOW!

start working on making emesene 2 the most awesome IM client on earth now!

here is a picture of a panda to motivate you, if this doesn't help I don't know what will...