File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88# OF ANY KIND, either express or implied. See the License for the specific language
99# governing permissions and limitations under the License.
1010
11- import pkg_resources
1211import re
1312from distutils .version import StrictVersion
1413from subprocess import call , Popen , PIPE
1514
1615from six import PY3
1716
1817from .cli import display
18+ try :
19+ from importlib import metadata as importlib_metadata
20+ except ImportError :
21+ import importlib_metadata
1922
2023
2124def validate_ops_version (min_ops_version ):
22- current_ops_version = [
23- x .version for x in pkg_resources .working_set if x .project_name == "ops-cli" ][0 ]
25+ try :
26+ current_ops_version = importlib_metadata .version ("ops-cli" )
27+ except Exception :
28+ raise Exception ("Cannot determine current ops-cli version from installed metadata." )
2429 if StrictVersion (current_ops_version ) < StrictVersion (min_ops_version ):
2530 raise Exception ("The current ops version {0} is lower than the minimum required version {1}. "
2631 "Please upgrade by following the instructions seen here: "
Original file line number Diff line number Diff line change 1717from ops .hierarchical .composition_config_generator import TerraformConfigGenerator
1818from distutils .version import StrictVersion
1919from ops import validate_ops_version
20- import pkg_resources
2120
2221logger = logging .getLogger (__name__ )
2322
You can’t perform that action at this time.
0 commit comments