diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbf0c207..55e83aab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,10 @@ jobs: run: | name=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])") version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") - if [ -d oracle/*_mcp_server ]; then + if [ -f oracle_mcp_common/__init__.py ]; then + init_py_file=oracle_mcp_common/__init__.py + python -c 'from pathlib import Path; import re, sys; p = Path(sys.argv[1]); text = p.read_text(); text, count = re.subn(r"^__version__ = \".*\"$", f"__version__ = \"{sys.argv[2]}\"", text, flags=re.MULTILINE); assert count == 1, f"Expected exactly one __version__ in {p}, found {count}"; p.write_text(text)' "$init_py_file" "$version" + elif [ -d oracle/*_mcp_server ]; then init_py_file=oracle/*_mcp_server/__init__.py echo "\"\"\"\nCopyright (c) 2025, Oracle and/or its affiliates.\nLicensed under the Universal Permissive License v1.0 as shown at\nhttps://oss.oracle.com/licenses/upl.\n\"\"\"\n" > $$init_py_file; \ echo "__project__ = \"$name\"" >> $init_py_file diff --git a/Makefile b/Makefile index a95ca399..56b57260 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,10 @@ _build: name=$$(python -c "import tomllib; print(tomllib.load(open('$$dir/pyproject.toml', 'rb'))['project']['name'])"); \ version=$$(python -c "import tomllib; print(tomllib.load(open('$$dir/pyproject.toml', 'rb'))['project']['version'])"); \ echo "Building $$dir: $$name==$$version"; \ - if [ -d $$dir/oracle/*_mcp_server ]; then \ + if [ -f "$$dir/oracle_mcp_common/__init__.py" ]; then \ + init_py_file="$$dir/oracle_mcp_common/__init__.py"; \ + python -c 'from pathlib import Path; import re, sys; p = Path(sys.argv[1]); text = p.read_text(); text, count = re.subn(r"^__version__ = \".*\"$$", f"__version__ = \"{sys.argv[2]}\"", text, flags=re.MULTILINE); assert count == 1, f"Expected exactly one __version__ in {p}, found {count}"; p.write_text(text)' "$$init_py_file" "$$version"; \ + elif [ -d $$dir/oracle/*_mcp_server ]; then \ init_py_file=$$(echo $$dir/oracle/*_mcp_server/__init__.py); \ printf '"""\nCopyright (c) 2025, 2026 Oracle and/or its affiliates.\nLicensed under the Universal Permissive License v1.0 as shown at\nhttps://oss.oracle.com/licenses/upl.\n"""\n\n' > $$init_py_file; \ echo "__project__ = \"$$name\"" >> $$init_py_file; \ diff --git a/src/common/CHANGELOG.md b/src/common/CHANGELOG.md index 2987544a..d837bb3d 100644 --- a/src/common/CHANGELOG.md +++ b/src/common/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to `oracle-mcp-common` are documented in this file. +## Unreleased + +### Fixed + +- Build-time version metadata now synchronizes `oracle_mcp_common.__version__` + with the package version declared in `pyproject.toml`. + ## 0.1.2 ### Fixed diff --git a/src/common/oracle_mcp_common/__init__.py b/src/common/oracle_mcp_common/__init__.py index baeb9b34..546bea7d 100644 --- a/src/common/oracle_mcp_common/__init__.py +++ b/src/common/oracle_mcp_common/__init__.py @@ -35,4 +35,4 @@ ] __project__ = "oracle_mcp_common" -__version__ = "0.1.1" +__version__ = "0.1.2"