Skip to content

Commit

Permalink
Merge pull request pedohorse#93 from pedohorse/bugfix_pluginloader-PY…
Browse files Browse the repository at this point in the history
…THONPATH_config-sqlite-relpath

Bugfix pluginloader pythonpath config sqlite relpath
  • Loading branch information
pedohorse authored Aug 3, 2024
2 parents b54be9b + ae07bee commit b6d8d62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/lifeblood/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def config_path(config_name: str, subname: Optional[str] = None) -> Path:
def config_unexpanded_path(config_name: str, subname: Optional[str] = None) -> Path:
if config_env_var_name in os.environ:
return Path(os.environ[config_env_var_name])/subname/config_name
base = Path('~')
base = Path.home()
if subname is None:
subname = 'common'
if '.' in subname:
Expand Down
6 changes: 3 additions & 3 deletions src/lifeblood/pluginloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ def _install_package(self, package_path: Path, plugin_category: str):
and (len(x) < 3 or x[2] == sysver.micro)]
pyvers = sorted(pyvers, key=lambda x: len(x), reverse=True)
for pyver in pyvers:
extra_python = python_base_path / '.'.join(str(x) for x in pyver)
sys.path.append(str(extra_python))
extra_python_str = str(python_base_path / '.'.join(str(x) for x in pyver))
sys.path.append(extra_python_str)

# TODO: this is questionable, this will affect all child processes, we don't want that, this should only be accessible to that one plugin
os.environ['PYTHONPATH'] = os.pathsep.join((str(extra_python), os.environ['PYTHONPATH'])) if 'PYTHONPATH' in os.environ else extra_python
os.environ['PYTHONPATH'] = os.pathsep.join((extra_python_str, os.environ['PYTHONPATH'])) if 'PYTHONPATH' in os.environ else extra_python_str

# install nodes
nodes_path = package_path / 'nodes'
Expand Down
6 changes: 4 additions & 2 deletions src/lifeblood/scheduler_config_provider_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def __init__(
self.__node_plugin_paths: Tuple[Path, ...] = tuple(node_plugin_paths)

def main_database_location(self) -> str:
return self.__config.get_option_noasync('core.database.path', str(paths.default_main_database_location()))
return os.path.expanduser(
self.__config.get_option_noasync('core.database.path', str(paths.default_main_database_location()))
)

def node_configuration(self, node_type_id: str) -> Mapping:
if node_type_id not in self.__node_config_cache:
Expand Down Expand Up @@ -240,7 +242,7 @@ def __init__(
self.__ui_address = ui_address

def main_database_location(self) -> str:
return self.__main_db_location_override or super().main_database_location()
return os.path.expanduser(self.__main_db_location_override) if self.__main_db_location_override is not None else super().main_database_location()

def main_database_connection_timeout(self) -> float:
return self.__main_db_connection_timeout or super().main_database_connection_timeout()
Expand Down

0 comments on commit b6d8d62

Please sign in to comment.