Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "MAPS"]
path = MAPS
url = https://github.com/drflei/MSM_maps.git
branch = master
29 changes: 29 additions & 0 deletions MAPS_UPDATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# MAPS submodule: tracking latest maps

This repository contains a MAPS submodule that points to the MSM_maps repository. The submodule has been configured to track the upstream branch `master` so you can update it to the latest maps with Git or with the provided helper script.

Options to get the latest maps:

- Using Git (recommended for developers / CI):

From the repository root:

```bash
git submodule sync --recursive
git submodule update --init --remote MAPS
# If you want to persist the new submodule commit in the superproject:
git add MAPS
git commit -m "Update MAPS submodule to latest"
```

- Using the helper script (convenient for users who don't want to run git submodule commands):

From the repository root:

```bash
python3 scripts/update_maps.py
```

Notes:
- The submodule is configured with `branch = master`. If the upstream branch name changes, update `.gitmodules` accordingly.
- The helper script calls `git clone` / `git pull` and therefore requires `git` to be installed and network access.
48 changes: 48 additions & 0 deletions scripts/update_maps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python3
"""
scripts/update_maps.py

Helper to clone or update the MAPS subrepository (MSM_maps).
Run from the repository root (or via python -m scripts.update_maps) to ensure the MAPS directory is populated/updated.
"""
import os
import subprocess
import sys

REPO_URL = "https://github.com/drflei/MSM_maps.git"

# MAPS directory relative to repository root: repo_root/MAPS
here = os.path.dirname(os.path.abspath(__file__))
REPO_ROOT = os.path.normpath(os.path.join(here, os.pardir))
MAPS_DIR = os.path.join(REPO_ROOT, "MAPS")


def run(cmd, check=True):
print('> ' + ' '.join(cmd))
return subprocess.run(cmd, check=check)


def ensure_maps():
maps_path = os.path.abspath(MAPS_DIR)
if not os.path.exists(maps_path):
print("Cloning MSM_maps into", maps_path)
run(["git", "clone", REPO_URL, maps_path])
# ensure the tracked branch exists locally
try:
run(["git", "-C", maps_path, "checkout", "master"])
except subprocess.CalledProcessError:
# continue if branch not present locally
pass
else:
print("Pulling latest changes into", maps_path)
# fetch and pull the configured remote/master
run(["git", "-C", maps_path, "fetch", "--all"])
run(["git", "-C", maps_path, "pull", "origin", "master"])


if __name__ == "__main__":
try:
ensure_maps()
except subprocess.CalledProcessError as e:
print("Error updating MAPS:", e, file=sys.stderr)
sys.exit(2)