mirror of
https://github.com/CMiksche/gitea-auto-update
synced 2025-12-09 23:47:21 +01:00
fix: file structure
This commit is contained in:
1
Pipfile
1
Pipfile
@@ -9,6 +9,7 @@ verify_ssl = true
|
||||
requests = "*"
|
||||
packaging = "*"
|
||||
fire = "*"
|
||||
configparser = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.7"
|
||||
|
||||
0
gitea_auto_update/__init__.py
Normal file
0
gitea_auto_update/__init__.py
Normal file
@@ -9,7 +9,7 @@ License: GNU General Public License
|
||||
import logging
|
||||
import configparser
|
||||
import fire
|
||||
from update import update
|
||||
import update
|
||||
|
||||
def updater(settings='settings.ini'):
|
||||
# Config
|
||||
@@ -19,12 +19,12 @@ def updater(settings='settings.ini'):
|
||||
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'))
|
||||
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)
|
||||
0
gitea_auto_update/lib/__init__.py
Normal file
0
gitea_auto_update/lib/__init__.py
Normal file
@@ -8,7 +8,9 @@ License: GNU General Public License
|
||||
'''
|
||||
import os
|
||||
import logging
|
||||
from update import version, download, build
|
||||
import lib.version
|
||||
import lib.download
|
||||
import lib.build
|
||||
|
||||
|
||||
class Update:
|
||||
@@ -26,8 +28,8 @@ class Update:
|
||||
self.getVersionAndTag()
|
||||
|
||||
def initVersionAndBuild(self):
|
||||
self.version = version.Version(self.gtSite, self.gtFile)
|
||||
self.build = build.Build(self.gtFile, self.sourceDir)
|
||||
self.version = lib.version.Version(self.gtSite, self.gtFile)
|
||||
self.build = lib.build.Build(self.gtFile, self.sourceDir)
|
||||
|
||||
def getVersionAndTag(self):
|
||||
self.currentVersion = self.version.getCurrentVersion() # Version from gitea site
|
||||
@@ -36,16 +38,16 @@ class Update:
|
||||
|
||||
def doUpdate(self):
|
||||
if self.buildFromSource: # Should the new version be build from source?
|
||||
build.fromSource(self.githubVersionTag)
|
||||
self.build.fromSource(self.githubVersionTag)
|
||||
else:
|
||||
self.download = download.Download(self.tmpDir,
|
||||
self.download = self.download.Download(self.tmpDir,
|
||||
self.githubVersion,
|
||||
self.githubVersionTag,
|
||||
self.gtSystem,
|
||||
self.gtFile)
|
||||
|
||||
def checkAndUpdate(self):
|
||||
if version.checkVersion(self.githubVersion, self.currentVersion): # Check if there is a new version
|
||||
if self.version.checkVersion(self.githubVersion, self.currentVersion): # Check if there is a new version
|
||||
logging.info('Update: new version available, stopping service')
|
||||
os.system("systemctl stop gitea.service")
|
||||
self.doUpdate()
|
||||
7
setup.py
7
setup.py
@@ -4,7 +4,7 @@ with open("README.md", "r") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setuptools.setup(name='gitea_auto_update',
|
||||
version='2.0.0',
|
||||
version='2.0.3',
|
||||
description='A script which can update gitea to a new version.',
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
@@ -21,10 +21,11 @@ setuptools.setup(name='gitea_auto_update',
|
||||
install_requires=[
|
||||
'requests',
|
||||
'packaging',
|
||||
'fire'
|
||||
'fire',
|
||||
'configparser'
|
||||
],
|
||||
packages=setuptools.find_packages(),
|
||||
entry_points={
|
||||
'console_scripts': ['gitea-auto-update=update.__init__:main'],
|
||||
'console_scripts': ['gitea-auto-update=gitea_auto_update.cli:main'],
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user