Skip to content

Commit 258faac

Browse files
enaplesScuttoZ
authored andcommitted
reckless: resolve symlink /tmp/ to /private/tmp`
1 parent 0815ff6 commit 258faac

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

tests/test_reckless.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def test_disable_enable(node_factory):
387387
dir=n.lightning_dir)
388388
assert r.returncode == 0
389389
assert r.search_stdout('testplugpass enabled')
390-
test_plugin = {'name': str(plugin_path / 'testplugpass.py'),
390+
test_plugin = {'name': str((plugin_path / 'testplugpass.py').resolve()),
391391
'active': True, 'dynamic': True}
392392
time.sleep(1)
393393
print(n.rpc.plugin_list()['plugins'])

tools/reckless

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -935,16 +935,17 @@ def create_wrapper(plugin: InstInfo):
935935
then run the plugin from within the same process.'''
936936
assert hasattr(plugin, 'venv')
937937
venv_full_path = Path(plugin.source_loc) / plugin.venv
938+
real_source_loc = str(Path(plugin.source_loc).resolve())
938939
with open(Path(plugin.source_loc) / plugin.entry, 'w') as wrapper:
939940
wrapper.write((f"#!{venv_full_path}/bin/python\n"
940941
"import sys\n"
941942
"import runpy\n\n"
942-
f"if '{plugin.source_loc}/{plugin.subdir}' not in "
943+
f"if '{real_source_loc}/{plugin.subdir}' not in "
943944
"sys.path:\n"
944-
f" sys.path.append('{plugin.source_loc}/"
945+
f" sys.path.append('{real_source_loc}/"
945946
f"{plugin.subdir}')\n"
946-
f"if '{plugin.source_loc}' in sys.path:\n"
947-
f" sys.path.remove('{plugin.source_loc}')\n"
947+
f"if '{real_source_loc}' in sys.path:\n"
948+
f" sys.path.remove('{real_source_loc}')\n"
948949
f"runpy.run_module(\"{plugin.name}\", "
949950
"{}, \"__main__\")"))
950951
wrapper_file = Path(plugin.source_loc) / plugin.entry
@@ -1875,7 +1876,7 @@ def enable(plugin_name: str):
18751876
except NotFoundError as err:
18761877
log.error(err)
18771878
return None
1878-
path = inst.entry
1879+
path = str(Path(inst.entry).resolve())
18791880
if not Path(path).exists():
18801881
log.error(f'cannot find installed plugin at expected path {path}')
18811882
return None
@@ -1907,7 +1908,7 @@ def disable(plugin_name: str):
19071908
except NotFoundError as err:
19081909
log.warning(f'failed to disable: {err}')
19091910
return None
1910-
path = inst.entry
1911+
path = str(Path(inst.entry).resolve())
19111912
if not Path(path).exists():
19121913
sys.stderr.write(f'Could not find plugin at {path}\n')
19131914
return None

0 commit comments

Comments
 (0)