43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
|
# Copyright 2016 Mycroft AI, Inc.
|
||
|
#
|
||
|
# This file is part of Mycroft Core.
|
||
|
#
|
||
|
# Mycroft Core is free software: you can redistribute it and/or modify
|
||
|
# it under the terms of the GNU General Public License as published by
|
||
|
# the Free Software Foundation, either version 3 of the License, or
|
||
|
# (at your option) any later version.
|
||
|
#
|
||
|
# Mycroft Core is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||
|
|
||
|
import json
|
||
|
from genericpath import exists, isfile
|
||
|
|
||
|
from mycroft.util.log import getLogger
|
||
|
|
||
|
__author__ = 'augustnmonteiro'
|
||
|
|
||
|
LOG = getLogger(__name__)
|
||
|
|
||
|
|
||
|
class VersionManager:
|
||
|
location = "/opt/mycroft/version.json"
|
||
|
|
||
|
def __init__(self):
|
||
|
pass
|
||
|
|
||
|
@staticmethod
|
||
|
def getVersion():
|
||
|
if exists(VersionManager.location) and isfile(VersionManager.location):
|
||
|
try:
|
||
|
with open(VersionManager.location) as f:
|
||
|
return json.load(f)
|
||
|
except Exception, e:
|
||
|
LOG.error("Load version from '%s'" % VersionManager.location)
|
||
|
return {"coreVersion": "", "enclosureVersion": ""}
|