-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy path__init__.py
More file actions
58 lines (50 loc) · 2.32 KB
/
__init__.py
File metadata and controls
58 lines (50 loc) · 2.32 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
# This file is part of OctoBot-Script (https://github.com/Drakkar-Software/OctoBot-Script)
# Copyright (c) 2023 Drakkar-Software, All rights reserved.
#
# OctoBot 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.0 of the License, or (at your option) any later version.
#
# OctoBot 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 OctoBot-Script. If not, see <https://www.gnu.org/licenses/>.
PROJECT_NAME = "OctoBot-Script"
AUTHOR = "Drakkar-Software"
VERSION = "0.1.1" # major.minor.revision => don't forget to also update the setup.py version
def _use_module_local_tentacles():
import sys
import os
import appdirs
if os.getenv("USE_CUSTOM_TENTACLES", "").lower() == "true":
# do not use octobot_script/imports tentacles
# WARNING: in this case, all the required tentacles imports still have to work
# and therefore be bound to another tentacles folder
return
# import tentacles from user-appdirs/imports directory
dirs = appdirs.AppDirs(PROJECT_NAME, AUTHOR, VERSION)
internal_import_path = os.path.join(dirs.user_data_dir, "imports")
sys.path.insert(0, internal_import_path)
# run this before any other code as only octobot_script module-local tentacles should be used
_use_module_local_tentacles()
try:
# import tentacles from octobot_script/imports directory after "_use_local_tentacles()" call
from tentacles.Meta.Keywords import *
# populate tentacles config helpers
import octobot_tentacles_manager.loaders as loaders
import octobot_script.internal.octobot_mocks as octobot_mocks
loaders.reload_tentacle_by_tentacle_class(
tentacles_path=octobot_mocks.get_imported_tentacles_path()
)
# do not expose those when importing this file
loaders = octobot_mocks = None
except ImportError:
# tentacles not available during first install
pass
from octobot_script.constants import *
from octobot_script.api import *
from octobot_script.model import *