Skip to content

Commit

Permalink
Merge pull request #903 from koordinates/gpkg-application-id
Browse files Browse the repository at this point in the history
Add GPKG application ID to GPKG working copies
  • Loading branch information
olsen232 committed Aug 29, 2023
2 parents a9df9c5 + 97767f4 commit 5872835
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Please note that compatibility for 0.x releases (software or repositories) isn't

_When adding new entries to the changelog, please include issue/PR numbers wherever possible._

## 0.14.2 (UNRELEASED)

- Fixes a bug where the GPKG application ID is not being written in GPKG working copies - other software reading the GPKG may be confused by this. [#902](https://github.com/koordinates/kart/issues/902)

## 0.14.1

- Fixes a bug where Git subprocesses (such as git clone) don't prompt the user for credentials or to resolve SSH issues on Windows. [#852](https://github.com/koordinates/kart/issues/852)
Expand Down
2 changes: 2 additions & 0 deletions kart/tabular/working_copy/gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ def status(self, check_if_dirty=False, allow_unconnectable=False):

def create_and_initialise(self):
with self.session() as sess:
sess.execute("PRAGMA application_id = 0x47504B47") # "GPKG"
sess.execute("PRAGMA user_version = 10300") # GPKG 1.3
# Create standard GPKG tables:
GpkgTables.create_all(sess)
GpkgTables.init_table_contents(sess)
Expand Down
18 changes: 18 additions & 0 deletions tests/test_working_copy_gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,3 +1240,21 @@ def test_global_mapper_compatibility(data_working_copy):
# But it does not understand this SQL snippet: VALUES (...), (...)
# Make sure that doesn't occur in our GPKG working copy.
assert all(not re.search(r"VALUES\s*\([^();]*\)\s*,", s) for s in schemas)


def test_gpkg_application_id(data_working_copy):
# See https://github.com/koordinates/kart/issues/902

try:
subprocess.check_output(["ogrinfo", "--version"])
except FileNotFoundError:
raise pytest.skip("This test only runs if ogrinfo is installed")

with data_working_copy("points") as (repo_path, wc_path):
r = subprocess.run(
["ogrinfo", "-ro", "-so", "-al", wc_path],
encoding="utf8",
capture_output=True,
)
# No warnings shown:
assert r.stderr == ""

0 comments on commit 5872835

Please sign in to comment.