Skip to content
Browse files

Fix import

The import of distutils here should have been of distutils.version.
  • Loading branch information...
1 parent 869185a commit c48a27aa5c3299a9ccdc7328de814c33521e86a0 @terminalmage terminalmage committed Jan 5, 2013
Showing with 12 additions and 9 deletions.
  1. +12 −9 salt/modules/pkg_resource.py
View
21 salt/modules/pkg_resource.py
@@ -8,7 +8,7 @@
import yaml
import pprint
import logging
-import distutils
+import distutils.version
log = logging.getLogger(__name__)
@@ -322,18 +322,21 @@ def find_changes(old=None, new=None):
def compare(pkg1='', pkg2=''):
'''
- Compares two version strings using distutils.LooseVersion. This is a
- fallback for providers which don't have a version comparison utility built
- into them. Return -1 if version1 < version2, 0 if version1 == version2,
- and 1 if version1 > version2. Return None if there was a problem making the
- comparison.
+ Compares two version strings using distutils.version.LooseVersion. This is
+ a fallback for providers which don't have a version comparison utility
+ built into them. Return -1 if version1 < version2, 0 if version1 ==
+ version2, and 1 if version1 > version2. Return None if there was a problem
+ making the comparison.
'''
try:
- if distutils.LooseVersion(pkg1) < distutils.LooseVersion(pkg2):
+ if distutils.version.LooseVersion(pkg1) < \
+ distutils.version.LooseVersion(pkg2):
return -1
- elif distutils.LooseVersion(pkg1) == distutils.LooseVersion(pkg2):
+ elif distutils.version.LooseVersion(pkg1) == \
+ distutils.version.LooseVersion(pkg2):
return 0
- elif distutils.LooseVersion(pkg1) > distutils.LooseVersion(pkg2):
+ elif distutils.version.LooseVersion(pkg1) > \
+ distutils.version.LooseVersion(pkg2):
return 1
except Exception as e:
log.exception(e)

0 comments on commit c48a27a

Please sign in to comment.
Something went wrong with that request. Please try again.