mirror of
https://github.com/CMiksche/gitea-auto-update
synced 2025-12-10 16:07:23 +01:00
fix: cli in update.py
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
'''
|
||||
Gitea Auto Updater
|
||||
|
||||
Copyright 2018, 2019 The Gitea-Auto-Update Authors
|
||||
All rights reserved.
|
||||
|
||||
License: GNU General Public License
|
||||
'''
|
||||
import logging
|
||||
import configparser
|
||||
import fire
|
||||
import update
|
||||
|
||||
def updater(settings='settings.ini'):
|
||||
# Config
|
||||
config = configparser.ConfigParser()
|
||||
config.read(settings)
|
||||
# Create a log file
|
||||
logging.basicConfig(filename=config.get('Gitea', 'logFile'), level=logging.DEBUG)
|
||||
# Start update
|
||||
update.Update(config.get('Gitea', 'site'),
|
||||
config.get('Gitea', 'file'),
|
||||
config.get('Gitea', 'sourceDir'),
|
||||
config.get('Gitea', 'apiUrl'),
|
||||
config.get('Gitea', 'buildFromSource'),
|
||||
config.get('Gitea', 'tmpDir'),
|
||||
config.get('Gitea', 'system'))
|
||||
|
||||
def main():
|
||||
fire.Fire(updater)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -8,11 +8,12 @@ License: GNU General Public License
|
||||
'''
|
||||
import os
|
||||
import logging
|
||||
import configparser
|
||||
import fire
|
||||
import lib.version
|
||||
import lib.download
|
||||
import lib.build
|
||||
|
||||
|
||||
class Update:
|
||||
|
||||
def __init__(self, gtSite, gtFile, sourceDir, apiUrl, buildFromSource, tmpDir, gtSystem):
|
||||
@@ -57,3 +58,24 @@ class Update:
|
||||
print("update successfully")
|
||||
else:
|
||||
print("current version is uptodate")
|
||||
|
||||
def updater(settings='settings.ini'):
|
||||
# Config
|
||||
config = configparser.ConfigParser()
|
||||
config.read(settings)
|
||||
# Create a log file
|
||||
logging.basicConfig(filename=config.get('Gitea', 'logFile'), level=logging.DEBUG)
|
||||
# Start update
|
||||
Update(config.get('Gitea', 'site'),
|
||||
config.get('Gitea', 'file'),
|
||||
config.get('Gitea', 'sourceDir'),
|
||||
config.get('Gitea', 'apiUrl'),
|
||||
config.get('Gitea', 'buildFromSource'),
|
||||
config.get('Gitea', 'tmpDir'),
|
||||
config.get('Gitea', 'system'))
|
||||
|
||||
def main():
|
||||
fire.Fire(updater)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user