Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdk-control-cli: fix circular import dependecy #1820

Merged
merged 3 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
import click
from pkg_resources import DistributionNotFound
from pkg_resources import get_distribution

# https://packaging.python.org/guides/single-sourcing-package-version/#

try:
# Change here if project is renamed and does not equal the setuptools metadata.name
dist_name = "vdk-control-cli"
__version__ = get_distribution(dist_name).version
except DistributionNotFound: # pragma: no cover
__version__ = "unknown"


def build_details():
try:
from vdk.internal.control import vdk_control_build_info

build = [
f"{key}={value}"
for key, value in vdk_control_build_info.__dict__.items()
if not key.startswith("_")
]
return ", ".join(build)
except:
return ""
from vdk.internal.control.utils.version_utils import __version__
from vdk.internal.control.utils.version_utils import build_details


@click.command(help="Prints the version of the client")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from configparser import ConfigParser
from pathlib import Path

from vdk.internal.control.command_groups.version_group import version
from vdk.internal.control.exception.vdk_exception import VDKException
from vdk.internal.control.utils import version_utils
from vdk.internal.control.utils.control_utils import read_config_ini_file

log = logging.getLogger(__name__)
Expand All @@ -23,7 +23,7 @@ class VDKConfig:

_user_agent = os.environ.get(
"VDK_CONTROL_SERVICE_USER_AGENT",
f"vdk-control-cli/{version.__version__} ({sys.platform}; {platform.platform()}; ) Python {platform.python_version()}",
f"vdk-control-cli/{version_utils.__version__} ({sys.platform}; {platform.platform()}; ) Python {platform.python_version()}",
)

@property
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2023-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
from pkg_resources import DistributionNotFound
from pkg_resources import get_distribution

# https://packaging.python.org/guides/single-sourcing-package-version/#
try:
# Change here if project is renamed and does not equal the setuptools metadata.name
dist_name = "vdk-control-cli"
__version__ = get_distribution(dist_name).version
except DistributionNotFound: # pragma: no cover
__version__ = "unknown"


def build_details():
try:
from vdk.internal.control import vdk_control_build_info

build = [
f"{key}={value}"
for key, value in vdk_control_build_info.__dict__.items()
if not key.startswith("_")
]
return ", ".join(build)
except:
return ""