Created
September 5, 2022 13:15
-
-
Save marcelcaraciolo/a8cff5015b7efe80c610c227999debdb to your computer and use it in GitHub Desktop.
check dependencies example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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