Difference between revisions of "Running a development version of Gramps"

From Gramps
Jump to: navigation, search
m (Gramps 4.0 and the master branch)
 
(20 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The following describes one possible scenario for building and running the latest development version of GRAMPS on [http://en.wikipedia.org/wiki/Ubuntu_%28operating_system%29 Ubuntu]:
+
== Preparation ==
 +
* These instructions assume you have installed a recent version of Ubuntu, or Linux Mint(which is Ubuntu based).
  
{{man warn|1=Note|2=It is beyond the scope of this document, but [http://en.wikipedia.org/wiki/VirtualBox VirtualBox] and [http://en.wikipedia.org/wiki/VMware VMWare] provide a great and relatively easy solution to getting a clean build environment up and running within 30 minutes on Linux.}}
+
* Install a text editor if you plan on modifying the Gramps source.  You can use any text editor such as gedit, kate, or sourcenav (<tt>sudo apt-get install sourcenav</tt>), erik4, SPE, or [http://www.eclipse.org Eclipse] with the python plugin. Instructions on [[Development using Eclipse and Pydev|installing and configuring Eclipse for Gramps development]].  Follow the [[Programming Guidelines|programming guidelines for Gramps]].
  
[[File:Paralle_versions_in_VB.png|350px|right|thumb|Example on VirtualBox]]
+
* [[Brief_introduction_to_Git#Obtaining_a_copy_of_the_Gramps_repository|Clone the Gramps repository]]
This picture shows a parallel installation on the same machine of both the svn version (running on a virtual machine) and the latest stable version. On the left hand side you can see Gramps 3.3.0-0 SVN 16310 running with Python 2.7.1, BSDDB 4.8.4 and Linux kernel 2.6.37 on Ubuntu Natty 11.04 alfa; on the right hand side you can see Gramps 3.2.5-1 with Python 2.6.6, BSDDB 4.7.3 and Linux kernel 2.6.35. The svn version is installed locally and running in a virtual machine on Oracle VM 4.0.0 r69151. The svn version was installed locally on the user home directory. Running the autogen script with --prefix=/home/user without make nor make install. I only ran the ''msgfmt'' to get the Dutch translation and copied the ''gramps.mo'' file to ''../trunk/po/local/LC_MESSAGES/'' and ran Gramps with the ''GRAMPSI18N=~/trunk/po python gramps.py'' in dir ~/trunk/src.
 
  
 +
== Gramps 4.0 and the master branch ==
 +
{{man note|Note|The steps in this section have been tested with Ubuntu 14.04}}
 +
{{man warn|1=Warning|2=Do not open your existing databases with the master branch, it might destroy your data, and will make it impossible to use the data in the stable version {{stable_branch}}. To try it out, export your database to a gramps xml file, eg <code>test_master.gramps</code>, create a new family tree in the master branch, and import this xml file.}}
  
 +
For the internationalization code to work, you need to have the translation tools.
  
 +
On Debian, just run (as root) - ('''Only if Debian installs Gramps 4.0+ as Gramps version!):
 +
apt-get build-dep gramps
  
 +
On Fedora 8 - 10 (Fedora is up to version 17 now so does this still apply?), you will need:
 +
yum install intltool gnome-doc-utils gettext git-core rcs
  
 +
=== Build ===
 +
Now go into the top-level directory and type(earlier versions of Gramps used python 2 and from Gramps 4.2.x and newer only python 3 so substitute as required eg: python3):
  
 +
python setup.py build
  
 +
{{man warn|1=Warning|2=Do not install the development version if you don't know how to version python modules. That is, do '''not''' type {{man label|sudo python setup.py install}}. }}
  
 +
=== Run ===
 +
==== Option 0: run from source repo ====
 +
From Gramps 4.2.x and master in the top-level directory you only need to type (this assumes your default python is python3):
  
 +
  python Gramps.py
  
 +
==== Option 1: run from source repo ====
 +
For Gramps 4.1.x and earlier (You can use either python or python3 substitute as necessary ):
  
 +
Here, we use the code in working directory to run Gramps. This means that compiled python files will be stored there. This is not ideal, but the easiest way to develop Gramps, as changes are immediately picked up by the code.
  
 +
Copy the const.py file created in build to your source directory if you want to use your source directory to work with Gramps:
 +
cp build/lib.linux-$(uname -m)-2.7/gramps/gen/const.py gramps/gen/const.py
 +
python Gramps.py
  
 +
''Note'': the <code>lib.linux-$(uname -m)-2.7</code> folder name vary depending on your system (i686 or x86_64).
  
 +
That is it. If you installed some dependencies of Gramps in non-default positions, you need to indicate with PYTHONPATH where they can be found, and with LD_LIBRARY_PATH where link libraries can be found. Eg, if you install GTK and spell checking from source too, you will need something like:
 +
  PYTHONPATH=/usr/local/lib/python2.7/site-packages/ LD_LIBRARY_PATH=/usr/local/lib python Gramps.py
  
 +
==== Option 2: use the build code ====
 +
Here, we use the code build in <code>trunk/build</code> directory to run Gramps. For compiled programs this is the only way, but for Gramps nothing is compiled. It is not bad however to keep your code separated from your execution, as deleting the build directory is easy. After a code change in your source, you then need to run however <code>python setup.py</code> again to update the build direcotry. To run Gramps from build, do
 +
  cd trunk/build/lib.linux-$(uname -m)-2.7/
 +
  python -c 'from gramps.grampsapp import main; main()'
  
 +
Again, it might be needed to set with PYTHONPATH where dependencies can be found, and with LD_LIBRARY_PATH link libraries, see option 1.
  
 +
If you point your PYTHONPATH to the build directory, you can actually run Gramps from a random directory. Like this:
  
 +
cd
 +
PYTHONPATH=~/gramps-trunk/build/lib.linux-$(uname -m)-2.7/ python -c 'from gramps.grampsapp import main; main()'
  
 +
So, more general:
 +
cd
 +
PYTHONPATH=~/gramps-trunk/build/lib.linux-$(uname -m)-2.7/:/usr/local/lib/python2.7/site-packages/ LD_LIBRARY_PATH=/usr/local/lib  python -c 'from gramps.grampsapp import main; main()'
  
<br clear="all" />
+
If the build directory is in your PYTHONPATH, you can also just execute the grampsapp.py module. So this will work too:
* Install a recent version of Ubuntu. ''The steps in this document have been tested with Ubuntu 7.04, 7.10, 8.04, 10.04 and 10.10.''
+
cd ~/gramps-trunk/build/lib.linux-$(uname -m)-2.7/gramps
 +
PYTHONPATH=~/gramps-trunk/build/lib.linux-$(uname -m)-2.7/ python grampsapp.py
  
* Install a text editor if you plan on modifying the GRAMPS source. You can use any text editor such as gedit, kate, or sourcenav (<tt>sudo apt-get install sourcenav</tt>), erik4, SPE, or [http://www.eclipse.org Eclipse] with the python plugin. Instructions on [[Development using Eclipse and Pydev|installing and configuring Eclipse for GRAMPS development]]. Note the [[Programming Guidelines|programming guidelines for GRAMPS]].
+
or again more generally
 +
PYTHONPATH=~/gramps-trunk/build/lib.linux-$(uname -m)-2.7/:/usr/local/lib/python2.7/site-packages/ LD_LIBRARY_PATH=/usr/local/lib python grampsapp.py
 +
 
 +
{{man note|Note using grampsapp.py works|all imports in Gramps have been converted to relative or absolute imports. This conversion was finished at the end of 2012.}}
 +
 
 +
{{man note|1=Known Problems|2=Some problems are due to the migration from GTK2 to GTK3: [[GEPS_029:_GTK3-GObject_introspection_Conversion#Problems|list of known problems]]}}
 +
 
 +
== Gramps 3.4 and before ==
 +
{{man note|Note|The steps in this section have been tested with Ubuntu 7.04, 7.10, 8.04, 10.04, 10.10 and 12.10 and Mint 14}}
  
 
* Install the tools we will need:
 
* Install the tools we will need:
  sudo apt-get install build-essential gnome-common libglib2.0-dev subversion
+
  sudo apt-get install build-essential gnome-common libglib2.0-dev git-core gettext
  
* Create a directory for the Gramps source:
+
=== Build ===
cd ~
+
* Get ready to build Gramps:
mkdir gramps
+
The old versions of Gramps use autotools, so you need to run:
  cd gramps
+
  ./autogen.sh
  
* Get the latest version of GRAMPS:
+
* Build Gramps:
svn co https://gramps.svn.sourceforge.net/svnroot/gramps/trunk
 
* Get ready to build GRAMPS:
 
cd trunk
 
./autogen.sh
 
* Build GRAMPS:
 
 
  make
 
  make
 +
 +
=== Run ===
 
* Run Gramps:
 
* Run Gramps:
 
  python src/gramps.py
 
  python src/gramps.py
  
 
At this point, any time you want to update to the latest version of Gramps, simply run:
 
At this point, any time you want to update to the latest version of Gramps, simply run:
  cd ~/gramps/trunk
+
  git pull --rebase
svn update
 
 
  python src/gramps.py
 
  python src/gramps.py
  
If some of the GRAMPS constants have changed and you obtain an error in const.py, rerun the commands <tt>autogen.sh</tt> and <tt>make</tt>.
+
If some of the Gramps constants have changed and you obtain an error in const.py, rerun the commands <tt>autogen.sh</tt> and <tt>make</tt>.
 +
 
 +
==See also==
 +
* [[Gramps for Windows with MSYS2]]
  
 
[[Category:Developers/General]]
 
[[Category:Developers/General]]

Latest revision as of 00:14, 11 February 2022

Preparation

  • These instructions assume you have installed a recent version of Ubuntu, or Linux Mint(which is Ubuntu based).

Gramps 4.0 and the master branch

Gramps-notes.png
Note

The steps in this section have been tested with Ubuntu 14.04

Gnome-important.png
Warning

Do not open your existing databases with the master branch, it might destroy your data, and will make it impossible to use the data in the stable version 52. To try it out, export your database to a gramps xml file, eg test_master.gramps, create a new family tree in the master branch, and import this xml file.

For the internationalization code to work, you need to have the translation tools.

On Debian, just run (as root) - (Only if Debian installs Gramps 4.0+ as Gramps version!):

apt-get build-dep gramps

On Fedora 8 - 10 (Fedora is up to version 17 now so does this still apply?), you will need:

yum install intltool gnome-doc-utils gettext git-core rcs

Build

Now go into the top-level directory and type(earlier versions of Gramps used python 2 and from Gramps 4.2.x and newer only python 3 so substitute as required eg: python3):

python setup.py build
Gnome-important.png
Warning

Do not install the development version if you don't know how to version python modules. That is, do not type sudo python setup.py install.

Run

Option 0: run from source repo

From Gramps 4.2.x and master in the top-level directory you only need to type (this assumes your default python is python3):

 python Gramps.py

Option 1: run from source repo

For Gramps 4.1.x and earlier (You can use either python or python3 substitute as necessary ):

Here, we use the code in working directory to run Gramps. This means that compiled python files will be stored there. This is not ideal, but the easiest way to develop Gramps, as changes are immediately picked up by the code.

Copy the const.py file created in build to your source directory if you want to use your source directory to work with Gramps:

cp build/lib.linux-$(uname -m)-2.7/gramps/gen/const.py gramps/gen/const.py
python Gramps.py

Note: the lib.linux-$(uname -m)-2.7 folder name vary depending on your system (i686 or x86_64).

That is it. If you installed some dependencies of Gramps in non-default positions, you need to indicate with PYTHONPATH where they can be found, and with LD_LIBRARY_PATH where link libraries can be found. Eg, if you install GTK and spell checking from source too, you will need something like:

 PYTHONPATH=/usr/local/lib/python2.7/site-packages/ LD_LIBRARY_PATH=/usr/local/lib python Gramps.py

Option 2: use the build code

Here, we use the code build in trunk/build directory to run Gramps. For compiled programs this is the only way, but for Gramps nothing is compiled. It is not bad however to keep your code separated from your execution, as deleting the build directory is easy. After a code change in your source, you then need to run however python setup.py again to update the build direcotry. To run Gramps from build, do

 cd trunk/build/lib.linux-$(uname -m)-2.7/
 python -c 'from gramps.grampsapp import main; main()'

Again, it might be needed to set with PYTHONPATH where dependencies can be found, and with LD_LIBRARY_PATH link libraries, see option 1.

If you point your PYTHONPATH to the build directory, you can actually run Gramps from a random directory. Like this:

cd
PYTHONPATH=~/gramps-trunk/build/lib.linux-$(uname -m)-2.7/ python -c 'from gramps.grampsapp import main; main()'

So, more general:

cd
PYTHONPATH=~/gramps-trunk/build/lib.linux-$(uname -m)-2.7/:/usr/local/lib/python2.7/site-packages/ LD_LIBRARY_PATH=/usr/local/lib  python -c 'from gramps.grampsapp import main; main()'

If the build directory is in your PYTHONPATH, you can also just execute the grampsapp.py module. So this will work too:

cd ~/gramps-trunk/build/lib.linux-$(uname -m)-2.7/gramps
PYTHONPATH=~/gramps-trunk/build/lib.linux-$(uname -m)-2.7/ python grampsapp.py

or again more generally

PYTHONPATH=~/gramps-trunk/build/lib.linux-$(uname -m)-2.7/:/usr/local/lib/python2.7/site-packages/ LD_LIBRARY_PATH=/usr/local/lib python grampsapp.py
Gramps-notes.png
Note using grampsapp.py works

all imports in Gramps have been converted to relative or absolute imports. This conversion was finished at the end of 2012.

Gramps-notes.png
Known Problems

Some problems are due to the migration from GTK2 to GTK3: list of known problems

Gramps 3.4 and before

Gramps-notes.png
Note

The steps in this section have been tested with Ubuntu 7.04, 7.10, 8.04, 10.04, 10.10 and 12.10 and Mint 14

  • Install the tools we will need:
sudo apt-get install build-essential gnome-common libglib2.0-dev git-core gettext

Build

  • Get ready to build Gramps:

The old versions of Gramps use autotools, so you need to run:

./autogen.sh
  • Build Gramps:
make

Run

  • Run Gramps:
python src/gramps.py

At this point, any time you want to update to the latest version of Gramps, simply run:

git pull --rebase
python src/gramps.py

If some of the Gramps constants have changed and you obtain an error in const.py, rerun the commands autogen.sh and make.

See also