Proceed when pip not found

This commit is contained in:
Daniel A. Wozniak 2020-05-17 11:16:48 +00:00 committed by Daniel Wozniak
parent 8aca842e9f
commit 604c6263a3

View file

@ -11,6 +11,7 @@ The setup script for salt
# For Python 2.5. A no-op on 2.6 and above.
from __future__ import absolute_import, print_function, with_statement
import contextlib
import distutils.dist
import glob
import inspect
@ -461,18 +462,25 @@ class DownloadWindowsDlls(Command):
if getattr(self.distribution, "salt_download_windows_dlls", None) is None:
print("This command is not meant to be called on it's own")
exit(1)
import pip
try:
import pip
# pip has moved many things to `_internal` starting with pip 10
if LooseVersion(pip.__version__) < LooseVersion("10.0"):
# pylint: disable=no-name-in-module
from pip.utils.logging import indent_log
# pip has moved many things to `_internal` starting with pip 10
if LooseVersion(pip.__version__) < LooseVersion("10.0"):
# pylint: disable=no-name-in-module
from pip.utils.logging import indent_log
# pylint: enable=no-name-in-module
else:
from pip._internal.utils.logging import (
indent_log,
) # pylint: disable=no-name-in-module
except ImportError:
# TODO: Impliment indent_log here so we don't require pip
@contextlib.contextmanager
def indent_log():
yield
# pylint: enable=no-name-in-module
else:
from pip._internal.utils.logging import (
indent_log,
) # pylint: disable=no-name-in-module
platform_bits, _ = platform.architecture()
url = "https://repo.saltstack.com/windows/dependencies/{bits}/{fname}.dll"
dest = os.path.join(os.path.dirname(sys.executable), "{fname}.dll")