From bbfc7213130cb47c0e08557d972931cc29e88f1b Mon Sep 17 00:00:00 2001 From: Eideen Date: Sun, 19 May 2019 13:07:34 +0200 Subject: [PATCH] Moved is_tool to functions --- functions.py | 10 ++++++++++ updater.py | 10 +--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/functions.py b/functions.py index 770322e..ebc3e20 100644 --- a/functions.py +++ b/functions.py @@ -30,6 +30,7 @@ def buildFromSource(tag): def getVersionList(string): return list(map(int, string.split('.'))) +string.split # Function to check if there is a new version def checkVersion(new_version, old_version): new_version_list = getVersionList(new_version) @@ -40,3 +41,12 @@ def checkVersion(new_version, old_version): return True return None + +# Function to check if tool is available +def is_tool(name): + ##Check whether `name` is on PATH and marked as executable. + + # from whichcraft import which + from shutil import which + + return which(name) is not None diff --git a/updater.py b/updater.py index 0e678b1..35e112d 100644 --- a/updater.py +++ b/updater.py @@ -11,15 +11,7 @@ import requests import os import functions -def is_tool(name): - ##Check whether `name` is on PATH and marked as executable. - - # from whichcraft import which - from shutil import which - - return which(name) is not None - -if not is_tool("xz"): +if not functions.is_tool("xz"): print ("missing dependency: xz") quit()