From 13e3086ba3ada9937d3b9cd3e923fed8364cfc58 Mon Sep 17 00:00:00 2001 From: Bodong Yang Date: Tue, 9 Apr 2024 12:54:58 +0000 Subject: [PATCH] not using extra version file anymore --- otaclient/__init__.py | 23 ++--------------------- otaclient/app/main.py | 4 +--- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/otaclient/__init__.py b/otaclient/__init__.py index cf36f7ca2..6c4bf729f 100644 --- a/otaclient/__init__.py +++ b/otaclient/__init__.py @@ -13,25 +13,6 @@ # limitations under the License. -from pathlib import Path +from otaclient._version import version, __version__ -# the package name for the otaclient package, -# in normal case it should be "otaclient" -otaclient_package_name = __name__.split(".")[0] - -try: - # version info is generated by setuptools-scm and stored in - # otaclient._version, check pyproject.toml for settings - from ._version import version as __version__, version_tuple -except ImportError: - from otaclient.app.configs import EXTRA_VERSION_FILE - - # try import version from VERSION file if any - _extra_version = Path(EXTRA_VERSION_FILE) - if _extra_version.is_file(): - __version__ = _extra_version.read_text() - else: - __version__ = "unknown" - version_tuple = (0, 0, "unknown") - -__all__ = ["__version__", "version_tuple"] +__all__ = ["version", "__version__"] diff --git a/otaclient/app/main.py b/otaclient/app/main.py index 58c0b3ab0..7501ad28e 100644 --- a/otaclient/app/main.py +++ b/otaclient/app/main.py @@ -22,7 +22,7 @@ from otaclient import __version__ # type: ignore from .proto import wrapper, v2, v2_grpc, ota_metafiles # noqa: F401 from .common import read_str_from_file, write_str_to_file_sync -from .configs import config as cfg, EXTRA_VERSION_FILE +from .configs import config as cfg from .log_setting import configure_logging from .ota_client_service import launch_otaclient_grpc_server @@ -52,8 +52,6 @@ def _check_other_otaclient(): def main(): logger.info("started") - if Path(EXTRA_VERSION_FILE).is_file(): - logger.info(read_str_from_file(EXTRA_VERSION_FILE)) logger.info(f"otaclient version: {__version__}") # start the otaclient grpc server