Skip to content

Instantly share code, notes, and snippets.

@marcelcaraciolo
Created September 5, 2022 13:15
Show Gist options
  • Save marcelcaraciolo/a8cff5015b7efe80c610c227999debdb to your computer and use it in GitHub Desktop.
Save marcelcaraciolo/a8cff5015b7efe80c610c227999debdb to your computer and use it in GitHub Desktop.
check dependencies example
import subprocess
def check_dependencies():
"""Ensure required tools for installation are present.
"""
print("Checking required dependencies")
for cmd, param, url in [("git", '--version', "http://git-scm.com/"),
("wget", '--version', "http://www.gnu.org/software/wget/"),
("curl", '--version', "http://curl.haxx.se/"),
('bzip2', '-h', 'www.bzip.org/')]:
try:
retcode = subprocess.call([cmd, param], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
except OSError:
retcode = 127
if retcode == 127:
raise OSError("Vallys requires %s (%s)" % (cmd, url))
else:
print " %s found" % cmd
check_dependencies()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment