2020-04-30 16:20:16 +02:00
|
|
|
From 3d5d89428ca333caa2c2259f679f8fffd7110ba6 Mon Sep 17 00:00:00 2001
|
2019-01-17 10:18:02 +01:00
|
|
|
From: Bo Maryniuk <bo@suse.de>
|
|
|
|
Date: Fri, 21 Sep 2018 17:31:39 +0200
|
|
|
|
Subject: [PATCH] Do not load pip state if there is no 3rd party
|
|
|
|
dependencies
|
|
|
|
|
|
|
|
Safe import 3rd party dependency
|
|
|
|
---
|
2019-04-12 11:57:21 +02:00
|
|
|
salt/modules/pip.py | 12 ++++++++++--
|
|
|
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
2019-01-17 10:18:02 +01:00
|
|
|
|
|
|
|
diff --git a/salt/modules/pip.py b/salt/modules/pip.py
|
2020-04-30 16:20:16 +02:00
|
|
|
index 0a0773a8f4..f19593ed1a 100644
|
2019-01-17 10:18:02 +01:00
|
|
|
--- a/salt/modules/pip.py
|
|
|
|
+++ b/salt/modules/pip.py
|
2020-04-07 14:14:01 +02:00
|
|
|
@@ -82,7 +82,10 @@ from __future__ import absolute_import, print_function, unicode_literals
|
2019-01-17 10:18:02 +01:00
|
|
|
# Import python libs
|
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
-import pkg_resources
|
|
|
|
+try:
|
|
|
|
+ import pkg_resources
|
|
|
|
+except ImportError:
|
|
|
|
+ pkg_resources = None
|
|
|
|
import re
|
|
|
|
import shutil
|
|
|
|
import sys
|
2020-04-30 16:20:16 +02:00
|
|
|
@@ -121,7 +124,12 @@ def __virtual__():
|
2019-01-17 10:18:02 +01:00
|
|
|
entire filesystem. If it's not installed in a conventional location, the
|
|
|
|
user is required to provide the location of pip each time it is used.
|
|
|
|
'''
|
|
|
|
- return 'pip'
|
|
|
|
+ if pkg_resources is None:
|
|
|
|
+ ret = False, 'Package dependency "pkg_resource" is missing'
|
|
|
|
+ else:
|
|
|
|
+ ret = 'pip'
|
|
|
|
+
|
|
|
|
+ return ret
|
|
|
|
|
|
|
|
|
2020-04-30 16:20:16 +02:00
|
|
|
def _pip_bin_env(cwd, bin_env):
|
2019-01-17 10:18:02 +01:00
|
|
|
--
|
2019-11-28 16:41:55 +01:00
|
|
|
2.16.4
|
2019-01-17 10:18:02 +01:00
|
|
|
|
|
|
|
|