jrl-cmakemodules-scripts 2.2.4__tar.gz → 2.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jrl-cmakemodules-scripts
3
- Version: 2.2.4
3
+ Version: 2.3.0
4
4
  Summary: Release scripting tools for JRL CMake modules
5
5
  License: BSD-3-Clause
6
6
  Project-URL: homepage, https://github.com/jrl-umi3218/jrl-cmakemodules
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jrl-cmakemodules-scripts
3
- Version: 2.2.4
3
+ Version: 2.3.0
4
4
  Summary: Release scripting tools for JRL CMake modules
5
5
  License: BSD-3-Clause
6
6
  Project-URL: homepage, https://github.com/jrl-umi3218/jrl-cmakemodules
@@ -46,11 +46,11 @@ uv run --no-project jrl_release.py --bump patch --git-commit --git-tag
46
46
  | Option | Description |
47
47
  | :--- | :--- |
48
48
  | `--root <PATH>` | Project root (default: cwd). |
49
- | `--bump <major|minor|patch>` | Bump version component. |
49
+ | `--bump {major,minor,patch}` | Bump version component. |
50
50
  | `--update-version <X.Y.Z>` | Set a specific version. |
51
51
  | `--dry-run` | Show changes without writing files. |
52
52
  | `--short` | Print only the version string. |
53
- | `--output-format <text|json>` | Output format (default: text). |
53
+ | `--output-format {text,json}` | Output format (default: text). |
54
54
  | `--confirm` | Skip interactive prompts. |
55
55
  | `--list-files` | List tracked files. |
56
56
  | `--git-commit [MSG]` | Commit changes. Optional message (`{version}` placeholder). |
@@ -98,6 +98,7 @@ import re
98
98
  import os
99
99
  import argparse
100
100
  import datetime
101
+ import importlib.metadata
101
102
  import json
102
103
  import subprocess
103
104
  import shutil
@@ -213,6 +214,8 @@ class XmlVersionExtractor(VersionExtractor):
213
214
  f.write(new_content)
214
215
 
215
216
  def get_url(self) -> str | None:
217
+ if not self.file_path.exists():
218
+ return None
216
219
  with open(self.file_path, "r", encoding="utf-8") as f:
217
220
  content = f.read()
218
221
  for url in re.findall(r"<url[^>]*>(.*?)</url>", content, re.I):
@@ -259,6 +262,8 @@ class TomlVersionExtractor(VersionExtractor):
259
262
  tomlkit.dump(data, f)
260
263
 
261
264
  def get_url(self) -> str | None:
265
+ if not self.file_path.exists():
266
+ return None
262
267
  with open(self.file_path, "r", encoding="utf-8") as f:
263
268
  data = tomlkit.load(f)
264
269
  if "project" in data and "urls" in data["project"]:
@@ -375,6 +380,8 @@ class CMakeListsVersionExtractor(VersionExtractor):
375
380
  return self._get_version_regex(content)
376
381
 
377
382
  def get_url(self) -> str | None:
383
+ if not self.file_path.exists():
384
+ return None
378
385
  with open(self.file_path, "r", encoding="utf-8") as f:
379
386
  content = f.read()
380
387
  if match := re.search(r'HOMEPAGE_URL\s+"([^"]+)"', content):
@@ -1730,6 +1737,11 @@ def main():
1730
1737
  )
1731
1738
 
1732
1739
  group = parser.add_mutually_exclusive_group(required=True)
1740
+ group.add_argument(
1741
+ "--version",
1742
+ action="store_true",
1743
+ help="Show jrl-cmakemodules-scripts version and exit",
1744
+ )
1733
1745
  group.add_argument(
1734
1746
  "--check-version", action="store_true", help="Check versions across files."
1735
1747
  )
@@ -1756,6 +1768,11 @@ def main():
1756
1768
  )
1757
1769
 
1758
1770
  args = parser.parse_args()
1771
+
1772
+ if args.version:
1773
+ print(importlib.metadata.version("jrl_cmakemodules_scripts"))
1774
+ sys.exit(0)
1775
+
1759
1776
  root_dir = args.root
1760
1777
 
1761
1778
  # Redirect console output to stderr for clean stdout with json/short
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "jrl-cmakemodules-scripts"
7
- version = "2.2.4"
7
+ version = "2.3.0"
8
8
  description = "Release scripting tools for JRL CMake modules"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"