Skip to content

Commit f10601c

Browse files
committed
fix: improve version reading logic in build-pkg.py
1 parent 8adb457 commit f10601c

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

building/macos/build-pkg.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,24 @@
66
import typing
77
import sys
88

9+
def read_version(version_file: Path) -> str:
10+
# First, if environment variable UDS_VERSION is set, use it
11+
env_version = os.environ.get("UDS_VERSION")
12+
if env_version:
13+
return env_version.strip()
14+
# Otherwise, read from the VERSION file
15+
if version_file.exists():
16+
return version_file.read_text().strip()
17+
return "DEVEL"
18+
19+
920
SCRIPT_DIR: typing.Final[Path] = Path(__file__).resolve().parent
1021
WORKSPACE_ROOT: typing.Final[Path] = SCRIPT_DIR.parent.parent.resolve()
1122
OUTPUT_DIR: typing.Final[Path] = SCRIPT_DIR / "package"
1223
BUILD_ROOT: typing.Final[Path] = SCRIPT_DIR / "build-root"
1324

1425
VERSION_FILE: typing.Final[Path] = WORKSPACE_ROOT.parent / "VERSION"
15-
VERSION: typing.Final[str] = VERSION_FILE.read_text().strip() if VERSION_FILE.exists() else "DEVEL"
26+
VERSION: typing.Final[str] = read_version(VERSION_FILE)
1627
BINARIES: typing.Final[list[str]] = [
1728
"udsactor-client",
1829
"udsactor-service",

0 commit comments

Comments
 (0)