Skip to content

Commit

Permalink
{Core} Remove deprecated usages of distutils to support Python 3.12 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
svenstaro committed Jul 26, 2024
1 parent 7fc89f9 commit b616adf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/azure-cli-core/azure/cli/core/extension/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import traceback
import json
import re
from distutils.sysconfig import get_python_lib # pylint: disable=deprecated-module
from sysconfig import get_path

import pkginfo
from knack.config import CLIConfig
Expand All @@ -22,7 +22,7 @@
EXTENSIONS_DIR = os.path.expanduser(_CUSTOM_EXT_DIR) if _CUSTOM_EXT_DIR else os.path.join(GLOBAL_CONFIG_DIR,
'cliextensions')
DEV_EXTENSION_SOURCES = _DEV_EXTENSION_SOURCES.split(',') if _DEV_EXTENSION_SOURCES else []
EXTENSIONS_SYS_DIR = os.path.expanduser(_CUSTOM_EXT_SYS_DIR) if _CUSTOM_EXT_SYS_DIR else os.path.join(get_python_lib(), 'azure-cli-extensions')
EXTENSIONS_SYS_DIR = os.path.expanduser(_CUSTOM_EXT_SYS_DIR) if _CUSTOM_EXT_SYS_DIR else os.path.join(get_path("purelib"), 'azure-cli-extensions')

EXTENSIONS_MOD_PREFIX = 'azext_'

Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/acs/_loadbalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from distutils.version import StrictVersion # pylint: disable=deprecated-module
from packaging.version import Version
from types import SimpleNamespace
from knack.log import get_logger

Expand All @@ -13,7 +13,7 @@
def set_load_balancer_sku(sku, kubernetes_version):
if sku:
return sku
if kubernetes_version and StrictVersion(kubernetes_version) < StrictVersion("1.13.0"):
if kubernetes_version and Version(kubernetes_version) < Version("1.13.0"):
logger.warning('Setting load_balancer_sku to basic as it is not specified and kubernetes'
'version(%s) less than 1.13.0 only supports basic load balancer SKU\n',
kubernetes_version)
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import uuid
import webbrowser
import zipfile
from distutils.version import StrictVersion # pylint: disable=deprecated-module
from packaging.version import Version
from urllib.error import URLError
from urllib.request import urlopen
from azure.cli.command_modules.acs.maintenanceconfiguration import aks_maintenanceconfiguration_update_internal
Expand Down Expand Up @@ -160,7 +160,7 @@ def _aks_browse(

return_msg = None
# open portal view if addon is not enabled or k8s version >= 1.19.0
if StrictVersion(instance.kubernetes_version) >= StrictVersion('1.19.0') or (not addon_profile.enabled):
if Version(instance.kubernetes_version) >= Version('1.19.0') or (not addon_profile.enabled):
subscription_id = get_subscription_id(cmd.cli_ctx)
dashboardURL = (
# Azure Portal URL (https://portal.azure.com for public cloud)
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
try:
from azure_cli_bdist_wheel import cmdclass
except ImportError:
from distutils import log as logger
import logging

logger.warn("Wheel is not available, disabling bdist_wheel hook")
logging.warning("Wheel is not available, disabling bdist_wheel hook")
cmdclass = {}

VERSION = "2.62.0"
Expand Down

0 comments on commit b616adf

Please sign in to comment.