mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
fix pkg_resources for usage with testing pip
We do weird things with the pip modules for salt-jenkins, we need to directly import the module instead of a function from the module for the namespacing we do there to work.
This commit is contained in:
parent
0ba39a7108
commit
2ddbcb45c1
2 changed files with 6 additions and 6 deletions
|
@ -82,7 +82,7 @@ import re
|
|||
import shutil
|
||||
import logging
|
||||
import sys
|
||||
from pkg_resources import parse_version
|
||||
import pkg_resources
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
|
@ -1287,7 +1287,7 @@ def list_all_versions(pkg,
|
|||
match = re.search(r'\s*Could not find a version.* \(from versions: (.*)\)', line)
|
||||
if match:
|
||||
versions = [v for v in match.group(1).split(', ') if v and excludes.match(v)]
|
||||
versions.sort(key=parse_version)
|
||||
versions.sort(key=pkg_resources.parse_version)
|
||||
break
|
||||
if not versions:
|
||||
return None
|
||||
|
|
|
@ -23,7 +23,7 @@ requisite to a pkg.installed state for the package which provides pip
|
|||
from __future__ import absolute_import
|
||||
import re
|
||||
import logging
|
||||
from pkg_resources import parse_version
|
||||
import pkg_resources
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
|
@ -266,11 +266,11 @@ def _pep440_version_cmp(pkg1, pkg2, ignore_epoch=False):
|
|||
pkg2 = normalize(pkg2)
|
||||
|
||||
try:
|
||||
if parse_version(pkg1) < parse_version(pkg2):
|
||||
if pkg_resources.parse_version(pkg1) < pkg_resources.parse_version(pkg2):
|
||||
return -1
|
||||
if parse_version(pkg1) == parse_version(pkg2):
|
||||
if pkg_resources.parse_version(pkg1) == pkg_resources.parse_version(pkg2):
|
||||
return 0
|
||||
if parse_version(pkg1) > parse_version(pkg2):
|
||||
if pkg_resources.parse_version(pkg1) > pkg_resources.parse_version(pkg2):
|
||||
return 1
|
||||
except Exception as exc:
|
||||
logger.exception(exc)
|
||||
|
|
Loading…
Add table
Reference in a new issue