How can I manage Gramps patches & configurations?

How do you manage your patches to Gramps? I am looking for practical ideas for keeping a logbook of how to reconfigure a fresh install.

I have a bunch of patches installed manually into my Gramps 5.1.2 version. Some are 5.2 targeted patches. Some are ‘fork’ patches that will never make it into the main product. So when 5.1.3 is released, I’ll lose them and have to repatch.

Likewise, when 5.1.3 comes out or it becomes necessary to re-import an XML backup in order to repair a corrupted database, important configuration customizations can be lost.

I’ve become aware that some Preferences are stored in the Tree (like when you change the ID format to have more leading zeroes), some are in .ini files in the application folder & some are in the user writable (%AppData% on a PC) space also for add-ons. How do you keep track of which are persistent across all Trees & which are Tree specific?

How do you keep track what has to be reset on each re-install or fresh import restore? Some are merely inconvenient but others would result in data loss or inconsistency.

The reason I’m asking about this:

Because of a post here, I was starting a Wiki page on how a user can manually install a GitHub patch. It isn’t an obvious process for the average user.

The new Age Stats Gramplet seemed like a good example.

But then I realized that it needed a section on managing the patchwork.

Applying patches to your standard Gramps is certainly possible, but moves you into a level of expertise that is quite a bit higher than most folks. I suggest that you make the next step, and learn ‘git’. This is designed to do exactly the kind of thing you are trying to do. You can set up a git copy of the Gramps Github repository on your machine. Then maintain a ‘branch’ of your own with 'merge’s from the various PRs and your own changes. The final product can be linked into your Gramps installation. When Gramps releases a new version, you can ‘rebase’ your changes onto the latest Gramps version, which will keep unique changes, as well as notice when one of your changes has already been done in the Gramps release and ignore them thereafter.

This is the sort of thing the developers do all the time. The tool is quite complex, but once you learn a few of the common operations, it becomes pretty routine to use.


That seems reasonable.

I think I’ll still do the step originally planned… write a wiki article on applying a single patch mentioned on the Mailist or in this Discourse forum. My suspicion is that most people are like me, they won’t make that leap to learning Git until there is enough pain to force them off the ledge.

And once I make that leap, I’ll lose the perspective needed to write something useful.

Oh. I forgot something while working off-site where there is Wi-Fi for my Gramps machine
My Gramps box is on SneakerNet. (Amazing how quickly we’re willing to forget the pain!) So Git managing my patches may not be a viable option for me.

1 Like

I have the same issues as you…

some times you do manually updates to something to get things working, but the next time you updates most everything is gone…

It should have been a backup of atleast settings when doing a complete Gramps Backup, where all user customized settings are backed up…

Regarding the different software patches (i.e. changes to python code), On Windows you can use Powershell, I have not yet made a PS Script to do this kind of things, but here is one article describing how to

In a .ps script you can have multiple command lines, so you can create one script that do all your replacement of text, copy/paste files and directories and so on.

Powershell can also be used on Linux, and I think there are powershell for Mac to (just dont remember)

IF you need, Powershell can also check if the text you need to replace already are there, but that will be a more advanced script… I have no clue how to do that…
but the simple explanation for what powershell can do in one “batch”

  • Replace multiple lines of code in a .py script or any other text file.
  • Replace or copy/paste any (many) file(s) or directory (folder) from one location on your computer to another.
  • Create a backup of the files you have changed in the .ps script using simple “Copy/Paste”.
  • Create a complete backup of your Gramps settings folders, including the addon folders.
  • Running python commands if you need to install python libraries to your computer after a fresh reinstall of the OS.

Powershell runs offline, no need for internet not even if you need to install new python libraries, those can be downloaded and transfered to the computer by external storage, you just need to write the python command to install a library from file…

If you install Gramps to the same folder when installing a fresh copy, you dont even need to change anything, and to copy to “program files”, just run the script with elevated rights (run as administrator).

1 Like

On windows 10:
Linking the git gramps/gramps folder to the installation always fails for me (gramps doesn’t open), while when I’m moving the released intallation gramps/gramps folder somewhere and linking it back to the installation directory always works. Is there a trick to get the git one working?

You did not mention any error codes, but it might be that you need to define GRAMPS_RESOURCES env variable (pointing to the Gramps fit directory). The normal install saves a small file ("…/gramps/gen/utils.resource-path") which does the same thing but which is missing in the git setup.


Yeah it seems that this “resource-path” file is missing and causing the problem. Copy & paste of the file into the right folder in the github repo makes the Gramps application work again, but I do struggle with the environment variable.
I added GRAMPS_RESOURCES linked to “…\GitHub\gramps” and also tried to link to “…\GitHub\gramps\gramps”, but both do not work.

I guess my “…” as a short form for whatever is the git location base was not understood. For Windows in your case that would usually be “C:\Users\you\Documents\Github\gramps”.

I was already using the whole link “C:\Users\you\Documents\Github\gramps”, but it wasn’t working.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.