Skip to content
Merged
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ The programs, version numbers, and the date stamp on the downloaded file used to
| mf6 | 6.8.2 | 10/30/2026 |
| mflgr | 2.0.0 | 09/20/2013 |
| mfnwt | 1.3.0 | 09/07/2022 |
| mfusg | 1.5 | 09/30/2025 |
| mfusg | 1.5.2 | 11/10/2026 |
| mfusgt | 2.8.1 | 11/01/2026 |
| mp6 | 6.0.1 | 10/23/2018 |
| mp7 | 7.2.001 | 10/23/2018 |
| mp6 | 6.0.1 | 11/16/2026 |
| mp7 | 7.2.001 | 11/16/2026 |
| mt3dms | 5.3.0 | 07/05/2023 |
| mt3dusgs | 1.1.1 | 11/02/2026 |
| mt3dusgs | 1.1.1 | 11/16/2026 |
| sutra | 4.0 | 12/19/2024 |
| swtv4 | 4.00.05 | 10/24/2018 |
| triangle | 1.6 | 05/26/2026 |
Expand Down
27 changes: 11 additions & 16 deletions scripts/patch_code_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ def _get_url_date(url):
try:
req = urllib.request.Request(url, method="HEAD")
with urllib.request.urlopen(req, timeout=10) as resp:
for key in ("Last-Modified", "Date"):
val = resp.headers.get(key)
if val:
dt = datetime.datetime.strptime(val, "%a, %d %b %Y %H:%M:%S %Z")
return dt.strftime("%m/%d/%Y")
val = resp.headers.get("Last-Modified")
if val:
dt = datetime.datetime.strptime(val, "%a, %d %b %Y %H:%M:%S %Z")
return dt.strftime("%m/%d/%Y")
except Exception:
pass
return None
Expand Down Expand Up @@ -88,23 +87,19 @@ def patch(
if prog_name not in code:
continue
prev_version = code[prog_name].get("version")
if prev_version == version:
continue
code[prog_name]["version"] = version
if url:
code[prog_name]["url"] = url
date = _get_url_date(url)
if date:
code[prog_name]["url_download_asset_date"] = date
changed.append(f" {prog_name}: {prev_version!r} -> {version!r}")

if changed:
for line in changed:
print(line)
code_json_path.write_text(json.dumps(code, indent=4) + "\n")
print(f"wrote {code_json_path}")
else:
print("code.json already up to date")
if prev_version != version:
changed.append(f" {prog_name}: {prev_version!r} -> {version!r}")

for line in changed:
print(line)
code_json_path.write_text(json.dumps(code, indent=4) + "\n")
print(f"wrote {code_json_path}")

if code_md_path:
write_code_md(code, code_md_path)
Expand Down
Loading