Skip to content

dep_check: stop using unsupported internal pip functions #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions dep_check.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import pip
import pkg_resources
import sys

def check_dependency():
list_deps = []
missing_deps = []

with open('requirements.txt') as f:
list_deps = f.read().splitlines()

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)
with open('requirements.txt', 'r') as reqs_file:
for req_dep in reqs_file.read().splitlines():
try:
pkg_resources.get_distribution(req_dep)
except pkg_resources.DistributionNotFound:
missing_deps.append(req_dep)

if missing_deps:
print "You are missing a module for Datasploit. Please install them using: "
print "pip install -r requirements.txt"
print "You are missing the following module(s) needed to run DataSploit:"
print ", ".join(missing_deps)
print "Please install them using: `pip install -r requirements.txt`"
sys.exit()