Included scripts_dir parent dir on sys.path so scripts can import members through the "scripts" package
This commit is contained in:
parent
0cd28f7499
commit
25ea0ea77c
1 changed files with 6 additions and 0 deletions
|
@ -3,6 +3,7 @@ import importlib
|
|||
import inspect
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import pkgutil
|
||||
import re
|
||||
import socket
|
||||
|
@ -81,6 +82,11 @@ class Config(object):
|
|||
with open(init_py, 'w') as f:
|
||||
f.write('# Auto-generated __init__.py - do not remove\n')
|
||||
|
||||
# Include scripts_dir parent in sys.path so members can be imported in scripts
|
||||
# through the `scripts` package
|
||||
scripts_parent_dir = str(pathlib.Path(self._config['scripts_dir']).absolute().parent)
|
||||
sys.path = [scripts_parent_dir] + sys.path
|
||||
|
||||
self._config['db'] = self._config.get('main.db', {
|
||||
'engine': 'sqlite:///' + os.path.join(
|
||||
os.path.expanduser('~'), '.local', 'share', 'platypush', 'main.db')
|
||||
|
|
Loading…
Reference in a new issue