19 lines
684 B
Python
Executable File
19 lines
684 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Print the FDS version derived from release tags or a Git source export."""
|
|
import argparse
|
|
import subprocess
|
|
from pathlib import Path
|
|
from fds_version import ROOT, cargo, version
|
|
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--root', type=Path, default=ROOT)
|
|
parser.add_argument('--cargo', action='store_true', help='emit Cargo build metadata and change tracking')
|
|
args = parser.parse_args()
|
|
try:
|
|
if args.cargo:
|
|
cargo(args.root.resolve())
|
|
else:
|
|
print(version(args.root))
|
|
except (OSError, ValueError, subprocess.CalledProcessError) as error:
|
|
parser.exit(1, f'Cannot determine FDS version: {error}\n')
|