mirror of
https://github.com/openshift/openshift-mcp-server.git
synced 2025-10-17 14:27:48 +03:00
feat(python): reads version from tag
This commit is contained in:
@@ -7,6 +7,13 @@ import shutil
|
||||
import tempfile
|
||||
import urllib.request
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from importlib.metadata import version
|
||||
else:
|
||||
from importlib_metadata import version
|
||||
|
||||
__version__ = version("kubernetes-mcp-server")
|
||||
|
||||
def get_platform_binary():
|
||||
"""Determine the correct binary for the current platform."""
|
||||
system = platform.system().lower()
|
||||
@@ -29,11 +36,11 @@ def get_platform_binary():
|
||||
else:
|
||||
raise RuntimeError(f"Unsupported operating system: {system}")
|
||||
|
||||
def download_binary(version="latest", destination=None):
|
||||
def download_binary(binary_version="latest", destination=None):
|
||||
"""Download the correct binary for the current platform."""
|
||||
binary_name = get_platform_binary()
|
||||
if destination is None:
|
||||
destination = Path.home() / ".kubernetes-mcp-server" / "bin"
|
||||
destination = Path.home() / ".kubernetes-mcp-server" / "bin" / binary_version
|
||||
|
||||
destination = Path(destination)
|
||||
destination.mkdir(parents=True, exist_ok=True)
|
||||
@@ -43,10 +50,10 @@ def download_binary(version="latest", destination=None):
|
||||
return binary_path
|
||||
|
||||
base_url = "https://github.com/manusa/kubernetes-mcp-server/releases"
|
||||
if version == "latest":
|
||||
if binary_version == "latest":
|
||||
release_url = f"{base_url}/latest/download/{binary_name}"
|
||||
else:
|
||||
release_url = f"{base_url}/download/{version}/{binary_name}"
|
||||
release_url = f"{base_url}/download/v{binary_version}/{binary_name}"
|
||||
|
||||
# Download the binary
|
||||
print(f"Downloading {binary_name} from {release_url}")
|
||||
@@ -71,7 +78,7 @@ def execute(args=None):
|
||||
args = []
|
||||
|
||||
try:
|
||||
binary_path = download_binary()
|
||||
binary_path = download_binary(binary_version=__version__)
|
||||
cmd = [str(binary_path)] + args
|
||||
|
||||
# Execute the binary with the provided arguments
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "kubernetes-mcp-server"
|
||||
version = "0.0.21-7-g869ebc2"
|
||||
version = "0.0.0"
|
||||
description = "Kubernetes MCP Server (Model Context Protocol) with special support for OpenShift"
|
||||
readme = {file="README.md", content-type="text/markdown"}
|
||||
requires-python = ">=3.6"
|
||||
|
||||
2
python/uv.lock
generated
2
python/uv.lock
generated
@@ -4,5 +4,5 @@ requires-python = ">=3.6"
|
||||
|
||||
[[package]]
|
||||
name = "kubernetes-mcp-server"
|
||||
version = "0.0.0.dev3"
|
||||
version = "0.0.23"
|
||||
source = { editable = "." }
|
||||
|
||||
Reference in New Issue
Block a user