mirror of
https://github.com/CMiksche/gitea-auto-update
synced 2025-12-10 16:07:23 +01:00
Merge update.py
This commit is contained in:
29
updater.py
29
updater.py
@@ -9,35 +9,10 @@ License: GNU General Public License
|
|||||||
import settings
|
import settings
|
||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
|
import functions
|
||||||
|
|
||||||
# Function to download a file
|
|
||||||
def download(url, file_name):
|
|
||||||
# open in binary mode
|
|
||||||
with open(file_name, "wb") as file:
|
|
||||||
# get request
|
|
||||||
response = requests.get(url)
|
|
||||||
# write to file
|
|
||||||
print ("writing file", file_name)
|
|
||||||
file.write(response.content)
|
|
||||||
|
|
||||||
# Function to build the new version from source
|
|
||||||
def buildFromSource(tag):
|
|
||||||
# Change to source dir
|
|
||||||
os.chdir(settings.source_dir)
|
|
||||||
# Checkout master
|
|
||||||
os.system("git checkout master")
|
|
||||||
# Update
|
|
||||||
os.system("git pull")
|
|
||||||
# Checkout relase branch
|
|
||||||
os.system("git checkout "+tag)
|
|
||||||
# Build from source
|
|
||||||
os.system('TAGS="bindata sqlite sqlite_unlock_notify" make generate build')
|
|
||||||
# Move binary
|
|
||||||
os.system("mv gitea "+settings.gtfile)
|
|
||||||
|
|
||||||
def is_tool(name):
|
def is_tool(name):
|
||||||
##Check whether `name` is on PATH and marked as executable.
|
##Check whether `name` is on PATH and marked as executable.
|
||||||
|
|
||||||
# from whichcraft import which
|
# from whichcraft import which
|
||||||
from shutil import which
|
from shutil import which
|
||||||
|
|||||||
Reference in New Issue
Block a user