1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 22:39:43 +00:00

add dependency checks for #225

This commit is contained in:
deadc0de6
2020-05-03 15:06:59 +02:00
parent 6ade21d7b6
commit ef4c48cadd
2 changed files with 18 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ from dotdrop.installer import Installer
from dotdrop.updater import Updater
from dotdrop.comparator import Comparator
from dotdrop.utils import get_tmpdir, remove, strip_home, \
run, uniq_list, patch_ignores
run, uniq_list, patch_ignores, dependencies_met
from dotdrop.linktypes import LinkTypes
from dotdrop.exceptions import YamlException
@@ -648,6 +648,13 @@ def main():
if o.debug:
LOG.dbg('\n\n')
# check dependencies are met
try:
dependencies_met()
except Exception as e:
LOG.err(e)
return False
ret = True
try:

View File

@@ -12,7 +12,7 @@ import uuid
import fnmatch
import inspect
import importlib
from shutil import rmtree
from shutil import rmtree, which
# local import
from dotdrop.logger import Logger
@@ -224,3 +224,12 @@ def get_module_from_path(path):
loader = importlib.machinery.SourceFileLoader(module_name, path)
mod = loader.load_module()
return mod
def dependencies_met():
"""make sure all dependencies are met"""
deps = ['file', 'diff', 'mkdir', 'cp']
err = 'The tool \"{}\" was not found in the PATH!'
for dep in deps:
if not which(dep):
raise Exception(err.format(dep))