Completely decouple runtime AppletDiscovery from local workspace paths
This commit is contained in:
@@ -16,13 +16,7 @@ class AppletDiscovery:
|
|||||||
if custom_applets_dir:
|
if custom_applets_dir:
|
||||||
self.search_dirs.append(Path(custom_applets_dir))
|
self.search_dirs.append(Path(custom_applets_dir))
|
||||||
|
|
||||||
# 1. Local workspace applets directory
|
# Only search the user home installed applets directory (~/.gravitiny/applets)
|
||||||
base_dir = Path(__file__).resolve().parent.parent
|
|
||||||
workspace_applets = base_dir / "applets"
|
|
||||||
if workspace_applets.exists():
|
|
||||||
self.search_dirs.append(workspace_applets)
|
|
||||||
|
|
||||||
# 2. User home applets directory (~/.gravitiny/applets)
|
|
||||||
user_applets = Path.home() / ".gravitiny" / "applets"
|
user_applets = Path.home() / ".gravitiny" / "applets"
|
||||||
if user_applets.exists() and user_applets not in self.search_dirs:
|
if user_applets.exists() and user_applets not in self.search_dirs:
|
||||||
self.search_dirs.append(user_applets)
|
self.search_dirs.append(user_applets)
|
||||||
|
|||||||
@@ -129,21 +129,8 @@ class ShimGenerator:
|
|||||||
is_windows = os.name == "nt"
|
is_windows = os.name == "nt"
|
||||||
python_exe = self._get_python_interpreter()
|
python_exe = self._get_python_interpreter()
|
||||||
|
|
||||||
# Locate core entrypoint
|
|
||||||
user_home = Path.home()
|
|
||||||
core_main = user_home / ".gravitiny" / "core" / "main.py"
|
|
||||||
if not core_main.exists():
|
|
||||||
core_main = Path(__file__).resolve().parent.parent / "main.py"
|
|
||||||
|
|
||||||
if is_windows:
|
if is_windows:
|
||||||
shim_file = self.bin_dir / f"{clean_name}.cmd"
|
shim_file = self.bin_dir / f"{clean_name}.cmd"
|
||||||
if core_main.exists():
|
|
||||||
content = (
|
|
||||||
"@echo off\n"
|
|
||||||
"setlocal\n"
|
|
||||||
f'"{python_exe}" "{core_main}" %*\n'
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
content = (
|
content = (
|
||||||
"@echo off\n"
|
"@echo off\n"
|
||||||
"setlocal\n"
|
"setlocal\n"
|
||||||
@@ -153,12 +140,6 @@ class ShimGenerator:
|
|||||||
f.write(content)
|
f.write(content)
|
||||||
else:
|
else:
|
||||||
shim_file = self.bin_dir / clean_name
|
shim_file = self.bin_dir / clean_name
|
||||||
if core_main.exists():
|
|
||||||
content = (
|
|
||||||
"#!/usr/bin/env sh\n"
|
|
||||||
f'exec "{python_exe}" "{core_main}" "$@"\n'
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
content = (
|
content = (
|
||||||
"#!/usr/bin/env sh\n"
|
"#!/usr/bin/env sh\n"
|
||||||
f'exec "{python_exe}" -m gravitiny "$@"\n'
|
f'exec "{python_exe}" -m gravitiny "$@"\n'
|
||||||
|
|||||||
Reference in New Issue
Block a user