mirror of
https://github.com/CMiksche/gitea-auto-update
synced 2025-12-10 16:07:23 +01:00
Moved is_tool to functions
This commit is contained in:
10
functions.py
10
functions.py
@@ -30,6 +30,7 @@ def buildFromSource(tag):
|
|||||||
def getVersionList(string):
|
def getVersionList(string):
|
||||||
return list(map(int, string.split('.')))
|
return list(map(int, string.split('.')))
|
||||||
|
|
||||||
|
string.split
|
||||||
# Function to check if there is a new version
|
# Function to check if there is a new version
|
||||||
def checkVersion(new_version, old_version):
|
def checkVersion(new_version, old_version):
|
||||||
new_version_list = getVersionList(new_version)
|
new_version_list = getVersionList(new_version)
|
||||||
@@ -40,3 +41,12 @@ def checkVersion(new_version, old_version):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
return None
|
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
|
||||||
|
|||||||
10
updater.py
10
updater.py
@@ -11,15 +11,7 @@ import requests
|
|||||||
import os
|
import os
|
||||||
import functions
|
import functions
|
||||||
|
|
||||||
def is_tool(name):
|
if not functions.is_tool("xz"):
|
||||||
##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"):
|
|
||||||
print ("missing dependency: xz")
|
print ("missing dependency: xz")
|
||||||
quit()
|
quit()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user