[go: up one dir, main page]

Menu

[cc83e9]: / tools / __init__.py  Maximize  Restore  History

Download this file

59 lines (52 with data), 2.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Drakkar-Software OctoBot
# Copyright (c) Drakkar-Software, All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library.
from __future__ import print_function
from distutils.version import LooseVersion
import os
import sys
MIN_PYTHON_VERSION = (3, 7)
MIN_TENTACLE_MANAGER_VERSION = "1.0.10"
# check python version
current_version = sys.version_info
if not current_version >= MIN_PYTHON_VERSION:
print("OctoBot requires a Python version to be higher or equal to Python " + str(MIN_PYTHON_VERSION[0])
+ "." + str(MIN_PYTHON_VERSION[1]) + " current Python version is " + str(current_version[0])
+ "." + str(current_version[1]) + "\n"
+ "You can download Python last versions on: https://www.python.org/downloads/", file=sys.stderr)
sys.exit(-1)
else:
# check compatible tentacle manager
try:
from tentacles_manager import VERSION
if LooseVersion(VERSION) < MIN_TENTACLE_MANAGER_VERSION:
print("OctoBot requires OctoBot-Tentacles-Manager in a minimum version of " + MIN_TENTACLE_MANAGER_VERSION +
" you can install and update OctoBot-Tentacles-Manager using the following command: "
"python3 -m pip install -U \"OctoBot-Tentacles-Manager<2.0.0\"", file=sys.stderr)
sys.exit(-1)
except ImportError:
print("OctoBot requires OctoBot-Tentacles-Manager, you can install it using "
"python3 -m pip install -U \"OctoBot-Tentacles-Manager<2.0.0\"", file=sys.stderr)
sys.exit(-1)
# binary tentacle importation
sys.path.append(os.path.dirname(sys.executable))
# if compatible version, can proceed with imports
from config import PlatformsName
from tools.os_util import get_os
from tools.logging.logging_util import get_logger
# check sudo rights
if get_os() is not PlatformsName.WINDOWS and os.getuid() == 0:
get_logger("PythonChecker").warning("OctoBot is started with admin / sudo rights that are not required, "
"please check you starting command ")