Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e55138e
Made so we ignore several Legacy import errors, and added line number…
ghcaveman Jul 15, 2026
e20c469
Changed file according to linter output
ghcaveman Jul 17, 2026
2da7a24
Revert event ignore to see if unit test will pass
ghcaveman Jul 18, 2026
d5e3c21
Attemptpipeline fixes
ghcaveman Jul 18, 2026
b00016c
Included the full libgedcom.py changes, as well as introduced the _PR…
ghcaveman Jul 22, 2026
4876bd9
Added _PAREN and _ITALIC tags
ghcaveman Jul 22, 2026
9cbe180
Added _NAME tags
ghcaveman Jul 22, 2026
a613268
Add _PLAC_DEFN tags
ghcaveman Jul 22, 2026
2304705
Added a few _EVENT_DEFN tags
ghcaveman Jul 22, 2026
b0406d9
Apply black formatting
ghcaveman Jul 22, 2026
247fd7a
Last little bit - boy is this ugly now
ghcaveman Jul 22, 2026
3662d08
Reverting gedcom file to see if anything fucking works in the gramps …
ghcaveman Jul 22, 2026
e8d6e3b
Reverted libgedcom becase the pipeline sucks ass
ghcaveman Jul 22, 2026
b2e7804
Pipeline test
ghcaveman Aug 3, 2026
99577ba
Reverted last change
ghcaveman Aug 3, 2026
857b04f
Adding some new tests for LDS-style file parsing
ghcaveman Aug 4, 2026
432adb9
Read output from original test script
ghcaveman Aug 5, 2026
a451614
Add the original imp_notetest_dfs file that has been modified to cont…
ghcaveman Aug 5, 2026
8bf2e34
Add missing data files
ghcaveman Aug 7, 2026
82e353e
Added more debug to parsing output
ghcaveman Aug 8, 2026
dd0bc73
Updated capture_gedcom_warnings
ghcaveman Aug 8, 2026
ffd7481
Fix pipeline
ghcaveman Aug 8, 2026
1de824b
Add imp_sample.difs allowed-exception file for GEDCOM import test
ghcaveman Aug 8, 2026
ef95cdf
Remove blank line
ghcaveman Aug 8, 2026
83cc2b2
Adjusted message width
ghcaveman Aug 9, 2026
d5aabe2
Ran back formatter on imports_test.py
ghcaveman Aug 14, 2026
909740e
Changed yml file so I can hopefully see WTF is going wrong
ghcaveman Aug 14, 2026
10d869a
Fix unit tests
ghcaveman Aug 14, 2026
069a82a
Another .yml update
ghcaveman Aug 15, 2026
7a42094
yml tweaks
ghcaveman Aug 15, 2026
ea1c863
another yml trial
ghcaveman Aug 15, 2026
2048808
Revert changes to yml
ghcaveman Aug 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions capture_gedcom_warnings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#! /usr/bin/env python3
"""Capture the GEDCOM import warning text without the GUI.

Replicates the import path used by Gramps (importData -> GedcomParser ->
parse_gedcom_file -> user.info(..., "".join(errors), ...)) but with a
User subclass that records the info text instead of showing a dialog.

Usage:
python capture_gedcom_warnings.py [input_file] [output_file]

Examples:
python capture_gedcom_warnings.py
python capture_gedcom_warnings.py imp_notetest_dfs.ged
python capture_gedcom_warnings.py imp_notetest_dfs.ged report.txt
"""

#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2026 Gramps Development Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, see <https://www.gnu.org/licenses/>.
#

# -------------------------------------------------------------------------
#
# Standard Python modules
#
# -------------------------------------------------------------------------
import os
import sys

# -------------------------------------------------------------------------
#
# Gramps modules
#
# -------------------------------------------------------------------------
from gramps.gen.const import TEST_DIR
from gramps.gen.db.utils import make_database
from gramps.gen.user import User
from gramps.gen.utils.config import config
from gramps.plugins.importer.importgedcom import importData


class CaptureUser(User):
"""A User that captures the info() text instead of displaying it."""

def __init__(self):
super().__init__()
self.report_title = ""
self.infotext = ""

def info(self, msg1, infotext, parent=None, monospaced=False):
self.report_title = msg1
self.infotext = infotext


def main():
"""Import the GEDCOM and print the captured warning text."""
input_file = (
sys.argv[1] if len(sys.argv) > 1 else "imp_notetest_lds_in-out-in_dfs.ged"
)
output_file = sys.argv[2] if len(sys.argv) > 2 else None
fn1 = os.path.join(TEST_DIR, input_file)

# Same "_dfs" preferences as imports_test.py make_tst_function()
config.set("preferences.default-source", True)
config.set("preferences.tag-on-import-format", "Imported")
config.set("preferences.tag-on-import", True)

# Set up a fresh in-memory database like the test does.
db = make_database("sqlite")
db.load(":memory:")
db.set_feature("skip-import-additions", False)

user = CaptureUser()
importData(db, fn1, user)

print("REPORT TITLE:", user.report_title)
print("REPORT TEXT:")
print(user.infotext)

if output_file:
with open(output_file, "w", encoding="utf-8") as out:
out.write(user.report_title + "\n")
out.write(user.infotext)
print(f"Wrote {output_file}")
return 0


if __name__ == "__main__":
sys.exit(main())
16 changes: 8 additions & 8 deletions data/tests/imp_FTM_16dec2015a-mod1.gramps
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE database PUBLIC "-//Gramps//DTD Gramps XML 1.7.1//EN"
"http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
<database xmlns="http://gramps-project.org/xml/1.7.1/">
<!DOCTYPE database PUBLIC "-//Gramps//DTD Gramps XML 1.7.2//EN"
"http://gramps-project.org/xml/1.7.2/grampsxml.dtd">
<database xmlns="http://gramps-project.org/xml/1.7.2/">
<header>
<created date="2019-03-13" version="5.0.2"/>
<created date="1999-12-25" version="6.1.0"/>
<researcher>
</researcher>
</header>
Expand Down Expand Up @@ -147,19 +147,19 @@
<note handle="_0000001500000015" change="1" id="N0001" type="GEDCOM import">
<text>Records not imported into OBJE (multi-media object) Gramps ID M159:

Could not import 1850 United States Federal Census(11)-1.jpg Line 70: 1 FILE 1850 United States Federal Census(11)-1.jpg
Could not import 1850 United States Federal Census(11)-1.jpg Line 70: 1 FILE 1850 United States Federal Census(11)-1.jpg
</text>
<style name="fontface" value="Monospace">
<range start="0" end="200"/>
<range start="0" end="234"/>
</style>
</note>
<note handle="_0000001700000017" change="1" id="N0002" type="GEDCOM import">
<text>Records not imported into OBJE (multi-media object) Gramps ID M158:

Could not import D:\Users\PRC\Downloads\1850 United States Federa Line 75: 1 FILE D:\Users\PRC\Downloads\1850 United States Federal Census(11)-1.jpg
Could not import D:\Users\PRC\Downloads\1850 United States Federal Census(11)-1.jpg Line 75: 1 FILE D:\Users\PRC\Downloads\1850 United States Federal Census(11)-1.jpg
</text>
<style name="fontface" value="Monospace">
<range start="0" end="223"/>
<range start="0" end="257"/>
</style>
</note>
</notes>
Expand Down
89 changes: 48 additions & 41 deletions data/tests/imp_FTM_PHOTO.gramps
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE database PUBLIC "-//Gramps//DTD Gramps XML 1.7.1//EN"
"http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
<database xmlns="http://gramps-project.org/xml/1.7.1/">
<!DOCTYPE database PUBLIC "-//Gramps//DTD Gramps XML 1.7.2//EN"
"http://gramps-project.org/xml/1.7.2/grampsxml.dtd">
<database xmlns="http://gramps-project.org/xml/1.7.2/">
<header>
<created date="2016-08-29" version="5.0.0-alpha1"/>
<created date="1999-12-25" version="6.1.0"/>
<researcher>
</researcher>
</header>
<people>
<person handle="_0000000100000001" change="1472500306" id="I0001">
<person handle="_0000000100000001" change="1" id="I0001">
<gender>U</gender>
<name type="Birth Name">
<first>The</first>
Expand All @@ -21,7 +21,7 @@
<objref hlink="_0000000700000007"/>
<noteref hlink="_0000000200000002"/>
</person>
<person handle="_0000000800000008" change="1472500306" id="I0002">
<person handle="_0000000800000008" change="1" id="I0002">
<gender>U</gender>
<name type="Birth Name">
<first>She</first>
Expand All @@ -35,7 +35,7 @@
<noteref hlink="_0000000900000009"/>
<noteref hlink="_0000000a0000000a"/>
</person>
<person handle="_0000001000000010" change="1472500306" id="I0003">
<person handle="_0000001000000010" change="1" id="I0003">
<gender>U</gender>
<name type="Birth Name">
<first>Edwin</first>
Expand All @@ -49,102 +49,109 @@
</person>
</people>
<objects>
<object handle="_0000000300000003" change="1472500306" id="M1">
<object handle="_0000000300000003" change="1" id="M1">
<file src="O1.jpg" mime="image/jpeg" description="Ferry Arriving 1910"/>
<noteref hlink="_0000000b0000000b"/>
</object>
<object handle="_0000000400000004" change="1472500306" id="M2">
<object handle="_0000000400000004" change="1" id="M2">
<file src="O2.jpg" mime="image/jpeg" description="B&amp;W Kids"/>
<noteref hlink="_0000000c0000000c"/>
</object>
<object handle="_0000000500000005" change="1472500306" id="M3">
<object handle="_0000000500000005" change="1" id="M3">
<file src="O3.jpg" mime="image/jpeg" description="Sourpuss in Hat"/>
<noteref hlink="_0000000d0000000d"/>
</object>
<object handle="_0000000600000006" change="1472500306" id="M4">
<object handle="_0000000600000006" change="1" id="M4">
<file src="O4.jpg" mime="image/jpeg" description="Girl Eating"/>
<noteref hlink="_0000000e0000000e"/>
</object>
<object handle="_0000000700000007" change="1472500306" id="M5">
<object handle="_0000000700000007" change="1" id="M5">
<file src="O5.jpg" mime="image/jpeg" description="Edwin &amp; Janice Smith"/>
<noteref hlink="_0000000f0000000f"/>
</object>
<object handle="_0000001200000012" change="1472500306" id="O0000">
<object handle="_0000001200000012" change="1" id="O0000">
<file src="O3.jpg" mime="image/jpeg" description="Sourpuss in Hat"/>
</object>
<object handle="_0000001300000013" change="1472500306" id="O0001">
<object handle="_0000001300000013" change="1" id="O0001">
<file src="O4.jpg" mime="image/jpeg" description="Girl Eating"/>
</object>
<object handle="_0000001400000014" change="1472500306" id="O0002">
<object handle="_0000001400000014" change="1" id="O0002">
<file src="O5.jpg" mime="image/jpeg" description="Edwin &amp; Janice Smith"/>
</object>
</objects>
<notes>
<note handle="_0000000200000002" change="1472500306" id="N0000" type="Person Note">
<note handle="_0000000200000002" change="1" id="N0000" type="Person Note">
<text>The primary photo should be a male Sourpuss in a Hat 03.jpg or Gid:M3</text>
</note>
<note handle="_0000000900000009" change="1472500306" id="N0001" type="Person Note">
<note handle="_0000000900000009" change="1" id="N0001" type="Person Note">
<text>The primary photo should be a girl eating 04.jpg or Gid:M4</text>
</note>
<note handle="_0000000a0000000a" change="1472500306" id="N0002" type="GEDCOM import">
<note handle="_0000000a0000000a" change="1" id="N0002" type="GEDCOM import">
<text>Records not imported into INDI (individual) Gramps ID I0002:

Line ignored as not understood Line 35: 3 WHAT ???</text>
Line ignored as not understood Line 35: 3 WHAT ???
</text>
<style name="fontface" value="Monospace">
<range start="0" end="153"/>
<range start="0" end="187"/>
</style>
</note>
<note handle="_0000000b0000000b" change="1472500306" id="N0003" type="GEDCOM import">
<note handle="_0000000b0000000b" change="1" id="N0003" type="GEDCOM import">
<text>Records not imported into OBJE (multi-media object) Gramps ID M1:

Could not import O1.jpg Line 38: 1 FILE O1.jpg</text>
Could not import O1.jpg Line 38: 1 FILE O1.jpg
</text>
<style name="fontface" value="Monospace">
<range start="0" end="161"/>
<range start="0" end="195"/>
</style>
</note>
<note handle="_0000000c0000000c" change="1472500306" id="N0004" type="GEDCOM import">
<note handle="_0000000c0000000c" change="1" id="N0004" type="GEDCOM import">
<text>Records not imported into OBJE (multi-media object) Gramps ID M2:

Could not import O2.jpg Line 41: 1 FILE O2.jpg</text>
Could not import O2.jpg Line 41: 1 FILE O2.jpg
</text>
<style name="fontface" value="Monospace">
<range start="0" end="161"/>
<range start="0" end="195"/>
</style>
</note>
<note handle="_0000000d0000000d" change="1472500306" id="N0005" type="GEDCOM import">
<note handle="_0000000d0000000d" change="1" id="N0005" type="GEDCOM import">
<text>Records not imported into OBJE (multi-media object) Gramps ID M3:

Could not import O3.jpg Line 44: 1 FILE O3.jpg</text>
Could not import O3.jpg Line 44: 1 FILE O3.jpg
</text>
<style name="fontface" value="Monospace">
<range start="0" end="161"/>
<range start="0" end="195"/>
</style>
</note>
<note handle="_0000000e0000000e" change="1472500306" id="N0006" type="GEDCOM import">
<note handle="_0000000e0000000e" change="1" id="N0006" type="GEDCOM import">
<text>Records not imported into OBJE (multi-media object) Gramps ID M4:

Could not import O4.jpg Line 47: 1 FILE O4.jpg</text>
Could not import O4.jpg Line 47: 1 FILE O4.jpg
</text>
<style name="fontface" value="Monospace">
<range start="0" end="161"/>
<range start="0" end="195"/>
</style>
</note>
<note handle="_0000000f0000000f" change="1472500306" id="N0007" type="GEDCOM import">
<note handle="_0000000f0000000f" change="1" id="N0007" type="GEDCOM import">
<text>Records not imported into OBJE (multi-media object) Gramps ID M5:

Could not import O5.jpg Line 50: 1 FILE O5.jpg</text>
Could not import O5.jpg Line 50: 1 FILE O5.jpg
</text>
<style name="fontface" value="Monospace">
<range start="0" end="161"/>
<range start="0" end="195"/>
</style>
</note>
<note handle="_0000001100000011" change="1472500306" id="N0008" type="Person Note">
<note handle="_0000001100000011" change="1" id="N0008" type="Person Note">
<text>The primary photo should be a male of pair 05.jpg</text>
</note>
<note handle="_0000001500000015" change="1472500306" id="N0009" type="GEDCOM import">
<note handle="_0000001500000015" change="1" id="N0009" type="GEDCOM import">
<text>Records not imported into INDI (individual) Gramps ID I0003:

Could not import O3.jpg Line 55: 1 OBJE
Could not import O4.jpg Line 59: 1 OBJE
Could not import O5.jpg Line 63: 1 OBJE</text>
Could not import O3.jpg Line 55: 1 OBJE
Could not import O4.jpg Line 59: 1 OBJE
Could not import O5.jpg Line 63: 1 OBJE
</text>
<style name="fontface" value="Monospace">
<range start="0" end="326"/>
<range start="0" end="428"/>
</style>
</note>
</notes>
Expand Down
Loading
Loading