1
0
mirror of https://github.com/CMiksche/gitea-auto-update synced 2025-12-10 07:57:23 +01:00

fix: file structure

This commit is contained in:
Christoph Miksche
2019-08-26 22:46:46 +02:00
parent 8b64d5f518
commit 05caef9d41
9 changed files with 20 additions and 16 deletions

View File

@@ -9,6 +9,7 @@ verify_ssl = true
requests = "*" requests = "*"
packaging = "*" packaging = "*"
fire = "*" fire = "*"
configparser = "*"
[requires] [requires]
python_version = "3.7" python_version = "3.7"

View File

View File

@@ -9,7 +9,7 @@ License: GNU General Public License
import logging import logging
import configparser import configparser
import fire import fire
from update import update import update
def updater(settings='settings.ini'): def updater(settings='settings.ini'):
# Config # Config

View File

View File

@@ -8,7 +8,9 @@ License: GNU General Public License
''' '''
import os import os
import logging import logging
from update import version, download, build import lib.version
import lib.download
import lib.build
class Update: class Update:
@@ -26,8 +28,8 @@ class Update:
self.getVersionAndTag() self.getVersionAndTag()
def initVersionAndBuild(self): def initVersionAndBuild(self):
self.version = version.Version(self.gtSite, self.gtFile) self.version = lib.version.Version(self.gtSite, self.gtFile)
self.build = build.Build(self.gtFile, self.sourceDir) self.build = lib.build.Build(self.gtFile, self.sourceDir)
def getVersionAndTag(self): def getVersionAndTag(self):
self.currentVersion = self.version.getCurrentVersion() # Version from gitea site self.currentVersion = self.version.getCurrentVersion() # Version from gitea site
@@ -36,16 +38,16 @@ class Update:
def doUpdate(self): def doUpdate(self):
if self.buildFromSource: # Should the new version be build from source? if self.buildFromSource: # Should the new version be build from source?
build.fromSource(self.githubVersionTag) self.build.fromSource(self.githubVersionTag)
else: else:
self.download = download.Download(self.tmpDir, self.download = self.download.Download(self.tmpDir,
self.githubVersion, self.githubVersion,
self.githubVersionTag, self.githubVersionTag,
self.gtSystem, self.gtSystem,
self.gtFile) self.gtFile)
def checkAndUpdate(self): 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') logging.info('Update: new version available, stopping service')
os.system("systemctl stop gitea.service") os.system("systemctl stop gitea.service")
self.doUpdate() self.doUpdate()

View File

@@ -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.0', version='2.0.3',
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",
@@ -21,10 +21,11 @@ setuptools.setup(name='gitea_auto_update',
install_requires=[ install_requires=[
'requests', 'requests',
'packaging', 'packaging',
'fire' 'fire',
'configparser'
], ],
packages=setuptools.find_packages(), packages=setuptools.find_packages(),
entry_points={ entry_points={
'console_scripts': ['gitea-auto-update=update.__init__:main'], 'console_scripts': ['gitea-auto-update=gitea_auto_update.cli:main'],
} }
) )