mirror of
https://github.com/CMiksche/gitea-auto-update
synced 2025-12-10 07:57: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 os
|
||||||
import logging
|
import logging
|
||||||
|
import configparser
|
||||||
|
import fire
|
||||||
import lib.version
|
import lib.version
|
||||||
import lib.download
|
import lib.download
|
||||||
import lib.build
|
import lib.build
|
||||||
|
|
||||||
|
|
||||||
class Update:
|
class Update:
|
||||||
|
|
||||||
def __init__(self, gtSite, gtFile, sourceDir, apiUrl, buildFromSource, tmpDir, gtSystem):
|
def __init__(self, gtSite, gtFile, sourceDir, apiUrl, buildFromSource, tmpDir, gtSystem):
|
||||||
@@ -57,3 +58,24 @@ class Update:
|
|||||||
print("update successfully")
|
print("update successfully")
|
||||||
else:
|
else:
|
||||||
print("current version is uptodate")
|
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()
|
||||||
4
setup.py
4
setup.py
@@ -4,7 +4,7 @@ with open("README.md", "r") as fh:
|
|||||||
long_description = fh.read()
|
long_description = fh.read()
|
||||||
|
|
||||||
setuptools.setup(name='gitea_auto_update',
|
setuptools.setup(name='gitea_auto_update',
|
||||||
version='2.0.4',
|
version='2.0.5',
|
||||||
description='A script which can update gitea to a new version.',
|
description='A script which can update gitea to a new version.',
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
@@ -26,6 +26,6 @@ setuptools.setup(name='gitea_auto_update',
|
|||||||
],
|
],
|
||||||
packages=setuptools.find_packages(),
|
packages=setuptools.find_packages(),
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': ['gitea-auto-update=gitea_auto_update.cli:main'],
|
'console_scripts': ['gitea-auto-update=gitea_auto_update.update:main'],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user