mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 15:09:54 -05:00
seperation
This commit is contained in:
parent
46ae0aa7db
commit
1a62196216
@ -4,50 +4,10 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
|||||||
This is the SpiceBot Update system.
|
This is the SpiceBot Update system.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sopel
|
|
||||||
from sopel.config.types import StaticSection, ValidatedAttribute
|
from sopel.config.types import StaticSection, ValidatedAttribute
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
from .Config import config as botconfig
|
|
||||||
|
|
||||||
|
|
||||||
class SpiceBot_Update_MainSection(StaticSection):
|
class SpiceBot_Update_MainSection(StaticSection):
|
||||||
gitrepo = ValidatedAttribute('gitrepo', default="https://github.com/SpiceBot/SpiceBot")
|
gitrepo = ValidatedAttribute('gitrepo', default="https://github.com/SpiceBot/SpiceBot")
|
||||||
gitbranch = ValidatedAttribute('gitbranch', default="master")
|
gitbranch = ValidatedAttribute('gitbranch', default="master")
|
||||||
|
|
||||||
|
|
||||||
class BotUpdates():
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.sopel = {
|
|
||||||
"version_local": sopel.version_info,
|
|
||||||
"version_local_num": sopel.__version__,
|
|
||||||
"version_url": 'https://sopel.chat/latest.json',
|
|
||||||
"version_online": None,
|
|
||||||
"version_online_num": None,
|
|
||||||
}
|
|
||||||
self.spicebot = False
|
|
||||||
|
|
||||||
self.check_sopel()
|
|
||||||
|
|
||||||
def check_sopel(self):
|
|
||||||
info = requests.get(self.sopel["version_url"], verify=botconfig.core.verify_ssl).json()
|
|
||||||
if self.sopel["version_local"].releaselevel == 'final':
|
|
||||||
self.sopel["version_online_num"] = info['version']
|
|
||||||
self.sopel["notes"] = info['release_notes']
|
|
||||||
else:
|
|
||||||
self.sopel["version_online_num"] = info['unstable']
|
|
||||||
self.sopel["notes"] = info.get('unstable_notes', '')
|
|
||||||
if self.sopel["notes"]:
|
|
||||||
self.sopel["notes"] = 'Full release notes at ' + self.sopel["notes"]
|
|
||||||
|
|
||||||
self.sopel["version_online"] = sopel._version_info(self.sopel["version_online_num"])
|
|
||||||
|
|
||||||
def check_spicebot(self):
|
|
||||||
return
|
|
||||||
self.sopel = True
|
|
||||||
# get actual version number, and commit count, and assemble a version
|
|
||||||
|
|
||||||
|
|
||||||
version = BotUpdates()
|
|
||||||
|
|||||||
47
sopel_modules/SpiceBot/Version.py
Normal file
47
sopel_modules/SpiceBot/Version.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# coding=utf8
|
||||||
|
from __future__ import unicode_literals, absolute_import, division, print_function
|
||||||
|
"""
|
||||||
|
This is the SpiceBot Update system.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import sopel
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
from .Config import config as botconfig
|
||||||
|
|
||||||
|
|
||||||
|
class BotVersion():
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.sopel = {
|
||||||
|
"version_local": sopel.version_info,
|
||||||
|
"version_local_num": sopel.__version__,
|
||||||
|
"version_url": 'https://sopel.chat/latest.json',
|
||||||
|
"version_online": None,
|
||||||
|
"version_online_num": None,
|
||||||
|
}
|
||||||
|
self.spicebot = False
|
||||||
|
|
||||||
|
self.check_sopel()
|
||||||
|
|
||||||
|
def check_sopel(self):
|
||||||
|
info = requests.get(self.sopel["version_url"], verify=botconfig.core.verify_ssl).json()
|
||||||
|
if self.sopel["version_local"].releaselevel == 'final':
|
||||||
|
self.sopel["version_online_num"] = info['version']
|
||||||
|
self.sopel["notes"] = info['release_notes']
|
||||||
|
else:
|
||||||
|
self.sopel["version_online_num"] = info['unstable']
|
||||||
|
self.sopel["notes"] = info.get('unstable_notes', '')
|
||||||
|
if self.sopel["notes"]:
|
||||||
|
self.sopel["notes"] = 'Full release notes at ' + self.sopel["notes"]
|
||||||
|
|
||||||
|
self.sopel["version_online"] = sopel._version_info(self.sopel["version_online_num"])
|
||||||
|
|
||||||
|
def check_spicebot(self):
|
||||||
|
return
|
||||||
|
self.sopel = True
|
||||||
|
# get actual version number, and commit count, and assemble a version
|
||||||
|
|
||||||
|
|
||||||
|
version = BotVersion()
|
||||||
@ -7,6 +7,11 @@ This module contains references only for other modules to utilize.
|
|||||||
"""
|
"""
|
||||||
# pylama:ignore=W0401,W0611
|
# pylama:ignore=W0401,W0611
|
||||||
|
|
||||||
|
|
||||||
|
from .configure import *
|
||||||
|
from .setup import *
|
||||||
|
from .shutdown import *
|
||||||
|
|
||||||
from .Config import *
|
from .Config import *
|
||||||
from .Logs import *
|
from .Logs import *
|
||||||
from .Database import *
|
from .Database import *
|
||||||
@ -32,12 +37,9 @@ from .Reddit import *
|
|||||||
from .DictComs import *
|
from .DictComs import *
|
||||||
from .Read import *
|
from .Read import *
|
||||||
from .Translate import *
|
from .Translate import *
|
||||||
|
from .Version import *
|
||||||
|
|
||||||
|
|
||||||
from .configure import *
|
|
||||||
from .setup import *
|
|
||||||
from .shutdown import *
|
|
||||||
|
|
||||||
__author__ = 'Sam Zick'
|
__author__ = 'Sam Zick'
|
||||||
__email__ = 'sam@deathbybandaid.net'
|
__email__ = 'sam@deathbybandaid.net'
|
||||||
__version__ = '0.1.1'
|
__version__ = '0.1.1'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user