From 5fe678e3d8abe1c5fa8ea3a564bdf89922d0ef87 Mon Sep 17 00:00:00 2001 From: Aan Date: Wed, 31 Jan 2018 17:52:23 +0700 Subject: [PATCH] Update depcheck feature for more accurate comparation --- dep_check.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/dep_check.py b/dep_check.py index 474251b8..af05dd48 100644 --- a/dep_check.py +++ b/dep_check.py @@ -11,8 +11,26 @@ def check_dependency(): pip_list = sorted([(i.key) for i in pip.get_installed_distributions()]) for req_dep in list_deps: - if req_dep not in pip_list: - missing_deps.append(req_dep) + compare_char = ["==", ">=", "<=", ">", "<", "!="] + for c in compare_char: + if c in req_dep: + pkg = req_dep.split(c) + if pkg[0] not in pip_list: + missing_deps.append(req_dep) + break + else: + installed_ver = pkg_resources.get_distribution(pkg[0]).version + if self.get_truth(installed_ver, c, pkg[1]): + break + else: + missing_deps.append(req_dep) + else: + if req_dep not in pip_list: + # Why this package is not in get_installed_distributions ? + if str(req_dep) == "argparse": + pass + else: + missing_deps.append(req_dep) if missing_deps: print "You are missing a module for Datasploit. Please install them using: "