Skip to content

Commit

Permalink
Merge pull request #63352 from dmurphy18/fix_63350
Browse files Browse the repository at this point in the history
Import StrictVersion and LooseVersion from setuptools.distutils.verison or setuptools._distutils.version
  • Loading branch information
garethgreenaway authored Dec 22, 2022
2 parents e2ea857 + d51e7db commit ac6ccb8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions changelog/63350.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Import StrictVersion and LooseVersion from setuptools.distutils.verison or setuptools._distutils.version, if first not available
7 changes: 1 addition & 6 deletions salt/utils/pkg/win.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,7 @@
except ImportError:
from collections import OrderedDict

try:
from salt.utils.versions import LooseVersion
except ImportError:
from setuptools._distutils.version import (
LooseVersion, # pylint: disable=blacklisted-module
)
from salt.utils.versions import LooseVersion

# pylint: disable=too-many-instance-attributes

Expand Down
16 changes: 12 additions & 4 deletions salt/utils/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,23 @@
import sys
import warnings

from setuptools._distutils.version import LooseVersion as _LooseVersion
from setuptools._distutils.version import StrictVersion as _StrictVersion
# pylint: disable=blacklisted-module
try:
from setuptools.distutils.version import LooseVersion as _LooseVersion
from setuptools.distutils.version import StrictVersion as _StrictVersion
except ImportError:
try:
from setuptools._distutils.version import LooseVersion as _LooseVersion
from setuptools._distutils.version import StrictVersion as _StrictVersion
except ImportError:
from distutils.version import LooseVersion as _LooseVersion
from distutils.version import StrictVersion as _StrictVersion


# pylint: enable=blacklisted-module
import salt.version

# pylint: disable=blacklisted-module


log = logging.getLogger(__name__)


Expand Down

0 comments on commit ac6ccb8

Please sign in to comment.