Run Gramps40 for Windows from source using Python 2.7.3

From Gramps
Revision as of 13:49, 12 February 2013 by Helge GRAMPS (talk | contribs)
Jump to: navigation, search

Introduction

This page gives information how to run Gramps 4.0.x from source on a Windows system. After some trials there was the result to focus on 32 bit Python 2.7.3 because of several issues related to Gtk and database connection. All steps were done by the author on Windows 7 64bit German.

There are some parts marked as "TODO ISSUE" because of known issues.

There are some parts marked as "TODO WORK" because it's not done yet done (work in progress).

Gnome-important.png
This is a work in progress...
Nobody guarantees anything at all!
Any comments and help (e.g. on wiki pages) are welcome.

Python

Requirements from README:

  • Python 2.7 or greater, Python 3.2 or greater (python version cannot be mixed)

We use: Python 2.7.3 32 bit from http://www.python.org/getit/ for all examples assumed to be installed into "C:\Python27".

Comment: For Win7 user it's easier to don't use "C:\Program Files (x86)\..." because for every change somewhere in this folder one has to activate the administrator's rights again and again.

Gtk, pyobject

Requirements from README:

  • GTK 3.0 or greater
  • pygobject 3.3.2 or greater
  • cairo, pango, pangocairo with instrospection bindings (the gi packages)
  • librsvg2 (svg icon view)
  • xdg-utils

Currently there are no official binaries available. With the help of an open source programmer we got this package (here again the authors personally thank for his good job supporting Gramps in this way - see there to know more about of his other work: http://opensourcepack.blogspot.de/2013/01/mypaint-and-pygi.html):

Comment: For all examples it's assumed that the included Gtk binaries will be stored into "C:\Python27\Lib\site-packages\gtk" and it's also strongly assumed that this value will be added to the windows environment variable PATH!

Checking the state of the package can be done by:

  • start Python (e. g.: C:\Python27>python)
  • and than call the functions as follows. There should be the same results.
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win 32
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import GObject
>>> Gtk.get_major_version()
3L
>>> Gtk.get_minor_version()
6L
>>> Gtk.get_micro_version()
4L
>>> from gi.repository import GObject
>>> GObject.pygobject_version
(3, 4, 2)

further Python packages

TODO WORK: Add the missing packages having a usable version. Because of time all packages not list above are not tried up today. It will be the job of the next time to go ahead to add all these packages.

Requirements from README:

The following package is needed for full translation of the interface to your language:
  language-pack-gnome-xx 
                   Translation of GTK elements to your language, with             
                   xx your language code eg for Dutch you need
                   language-pack-gnome-nl. The translation of the
                   Gramps strings is included with the source code.
The following packages are *STRONGLY RECOMMENDED* to be installed:
  osmgpsmap        Used to show maps in the geography view. 
                   Without this the GeoView will not be active, see
                   http://gramps-project.org/wiki/index.php?title=Gramps_4.0_Wiki_Manual_-_Main_Window#Geography_Category
                   The package is named osmgpsmap, osm-gps-map
                   or python-osmgpsmap. Or obtain it from: http://nzjrs.github.com/osm-gps-map/
  GraphViz         Enable creation of graphs using GraphViz engine.
                   Without this no beautiful graphs can be created.
                   Obtain it from: http://www.graphviz.org
  pyexiv2          Enables Gramps to manage Exif metadata embedded in your
                   media. Gramps needs version 0.1.3 or greater.
                   Obtain it from: http://tilloy.net/dev/pyexiv2/download.html  

The following packages are optional

  gtkspell         Enable spell checking in the notes. Gtkspell depends on 
                   enchant. A version of gtkspell with gobject introspection
                   is needed, so minimally version 3.0.0
  rcs              The GNU Revision Control System (RCS) can be used to manage
                   multiple revisions of your family trees. See info at
                   http://www.gramps-project.org/wiki/index.php?title=Gramps_4.0_Wiki_Manual_-_Manage_Family_Trees#Archiving_a_Family_Tree
                   Only rcs is needed, NO python bindings are required
  PIL              Python Image Library is needed to convert non jpg images to
                   jpg so as to include them in LaTeX output
  ttf-freefont     More font support in the reports
  gir-webkit       GObject introspection data of WebKit is required for the
                   hidden view 'Htmlview', which allows websites to be opened in
                   Gramps. Users can unhide the view in the plugin manager. 
                   A html renderer must be installed to use the view.
                   !! PACKAGERS, Test if on your distribution
                   webkit and Gramps is stable. If you obtain crashes, patch 
                   src/plugins/view/htmlrenderer.py and
                   src/plugins/view/geoview.gpr.py, so as to remove:
                      from gi.repository import WebKit as webkit
  goocanvas2:
                   Required for the Graphview plugin

Debug Environment

MinGW

TODO WORK: description

Eclipse

TODO WORK: description

Start Gramps 4.0

Get Gramps sources

For all examples it's assumed that the Gramps source (e.g. from the repository http://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40) will be stored into "C:\Gramps4.0".

It's helpful to use a Subversion client for Windows to get these sources. Also if one gets sources only such a tool provides the possibility of history search and or compare and also to mark differences between the current version on the computer and the repository.

There are good experiences using TortoiseSVN from http://tortoisesvn.net/downloads.html.

Prepare Setup

To run setup.py we need the translation tools from http://sourceforge.net/projects/gnuwin32/files/gettext/0.14.4/gettext-0.14.4.exe/download?use_mirror=switch&download=: Download gettext-0.14.4.exe and run it to install.

For all examples assumed to be installed to: "C:\Program Files (x86)\GnuWin32\bin" (The default path of the installer)

Run Setup Build

Running "setup.py build" generates necessary translation files (*.mo) and the const.py from const.py.in

Here is an example batch file to run this:


C:
cd C:\Gramps4.0
set path=C:\Python27;C:\Program Files (x86)\GnuWin32\bin;%path%
C:\Python27\python setup.py build
pause

The result should look like this:

running build
Compiling po\bg.po >> share/locale/bg/LC_MESSAGES.
Compiling po\ca.po >> share/locale/ca/LC_MESSAGES.
Compiling po\cs.po >> share/locale/cs/LC_MESSAGES.
Compiling po\da.po >> share/locale/da/LC_MESSAGES.
Compiling po\de.po >> share/locale/de/LC_MESSAGES.
Compiling po\el.po >> share/locale/el/LC_MESSAGES.
Compiling po\en_GB.po >> share/locale/en_GB/LC_MESSAGES.
Compiling po\es.po >> share/locale/es/LC_MESSAGES.
Compiling po\fi.po >> share/locale/fi/LC_MESSAGES.
Compiling po\fr.po >> share/locale/fr/LC_MESSAGES.
Compiling po\he.po >> share/locale/he/LC_MESSAGES.
Compiling po\hr.po >> share/locale/hr/LC_MESSAGES.
Compiling po\hu.po >> share/locale/hu/LC_MESSAGES.
Compiling po\it.po >> share/locale/it/LC_MESSAGES.
Compiling po\ja.po >> share/locale/ja/LC_MESSAGES.
Compiling po\lt.po >> share/locale/lt/LC_MESSAGES.
Compiling po\nb.po >> share/locale/nb/LC_MESSAGES.
Compiling po\nl.po >> share/locale/nl/LC_MESSAGES.
Compiling po\nn.po >> share/locale/nn/LC_MESSAGES.
Compiling po\pl.po >> share/locale/pl/LC_MESSAGES.
Compiling po\pt_BR.po >> share/locale/pt_BR/LC_MESSAGES.
Compiling po\pt_PT.po >> share/locale/pt_PT/LC_MESSAGES.
Compiling po\ru.po >> share/locale/ru/LC_MESSAGES.
Compiling po\sk.po >> share/locale/sk/LC_MESSAGES.
Compiling po\sl.po >> share/locale/sl/LC_MESSAGES.
Compiling po\sq.po >> share/locale/sq/LC_MESSAGES.
Compiling po\sv.po >> share/locale/sv/LC_MESSAGES.
Compiling po\uk.po >> share/locale/uk/LC_MESSAGES.
Compiling po\vi.po >> share/locale/vi/LC_MESSAGES.
Compiling po\zh_CN.po >> share/locale/zh_CN/LC_MESSAGES.
running build_py
copying gramps\gen\const.py -> build\lib\gramps\gen
running build_scripts
C:\Gramps4.0>pause
Hit any key . . .

Comments:

  • After running this it would be possible to run Gramps from "C:\Gramps4.0" or from some where "C:\Gramps4.0\build\...".
  • For easy handling of sources from the repository the author prefers to run it from "C:\Gramps4.0".
  • It's also possible to generate .mo files by command line jobs. (TODO WORK: description)
  • It's also possible to manipulate const.py manually. (TODO WORK: description)

Work arounds

TODO ISSUE: Each work around to be removed if not necessary any more

  • Currently there is an issue between setup.py and trans.py that's why we need manually changes in ""C:\Gramps4.0\gramps\gen\const.py, line 203 to 206: In all string paths for LOCALE_DIR , DATA_DIR, IMAGE_DIR, DOC_DIR replace '\' by '\\'
  • As described in issue 6429 [1] there is a work around to have the drop down menu for gramplets in the side and bottom bar working.

Start Gramps

At this point we have a basically running Gramps.

Because we didn't add all packages suggested by the README we didn't have the full functionality. Especially some output formats and the geographic view are not available yet (TODO WORK: Add the missing packages having a usable version.)

Because Gramps 4.0 is still under development there are still several issues and crashes (see bug tracker: http://www.gramps-project.org/bugs/view_all_bug_page.php). It's strongly recommended to use test data for validation only!

To run Gramps a batch seems to be helpful:


set LANG=en_GB
SET LANGUAGE=en_GB

@rem may be some time we need an other language
@rem set LANG=de
@rem SET LANGUAGE=de

@rem it's a good idea to have a own GRAMPSHOME
set GRAMPSHOME=C:\Gramps_test\Gramps40
@rem we need the path of the Gtk binaries
set path=C:\Python27\lib\site-packages\gtk;%path%

@rem let's jump to Python binaries
C:
cd C:\Python27

@rem call for all version information (e.g. as background for any issue)
python "C:\Gramps4.0\gramps.py" -v

@rem let's start Gramps
python "C:\Gramps4.0\gramps.py"
pause