v1.8.71: fix Windows compatibility — guard Linux-only X11 code with platform check
- main.py: wrap _ensure_display_access() in sys.platform != "win32" check - main.py: add FileNotFoundError to except in _find_active_xauthority() - claude_setup.py: platform-aware error message for ssh-keygen not found - CLAUDE.md: add mandatory cross-platform rules for all contributors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
CLAUDE.md
13
CLAUDE.md
@@ -2,7 +2,18 @@
|
|||||||
|
|
||||||
## Проект
|
## Проект
|
||||||
|
|
||||||
ServerManager — Desktop GUI (CustomTkinter) для управления удалёнными серверами **любых типов**. Claude Code управляет серверами через скилл `/ssh`, зная только алиасы.
|
ServerManager — **кроссплатформенное** Desktop GUI (CustomTkinter) для управления удалёнными серверами **любых типов**. Работает на **Windows и Linux**. Claude Code управляет серверами через скилл `/ssh`, зная только алиасы.
|
||||||
|
|
||||||
|
## КРОССПЛАТФОРМЕННОСТЬ — ОБЯЗАТЕЛЬНО
|
||||||
|
|
||||||
|
Приложение собирается и работает на **Windows** и **Linux**. При любых правках кода:
|
||||||
|
|
||||||
|
- **Никогда** не использовать хардкод Linux-путей (`/home`, `/tmp`, `/root`) без проверки `sys.platform`
|
||||||
|
- **Никогда** не вызывать Linux-only команды (`ps`, `xhost`, `xdpyinfo`, `xauth`) без `if sys.platform != "win32"`
|
||||||
|
- Пути строить через `os.path.join()` / `os.path.expanduser()`, **не** через строковую конкатенацию с `/`
|
||||||
|
- Subprocess-вызовы, специфичные для ОС — оборачивать в проверку платформы
|
||||||
|
- `os.scandir("/home")` → **сломает Windows** (`FileNotFoundError`). Такой код допустим только внутри `if sys.platform != "win32"`
|
||||||
|
- Тестировать билд на Windows (`python build.py`) после каждого изменения
|
||||||
|
|
||||||
## Поддерживаемые типы серверов
|
## Поддерживаемые типы серверов
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,8 @@ def generate_ssh_key() -> str:
|
|||||||
log.info(f"SSH key generated: {SSH_KEY_PATH}")
|
log.info(f"SSH key generated: {SSH_KEY_PATH}")
|
||||||
return f"Key generated: {SSH_KEY_PATH}"
|
return f"Key generated: {SSH_KEY_PATH}"
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
msg = "ERROR: ssh-keygen not found — install openssh-client"
|
hint = "enable OpenSSH optional feature" if sys.platform == "win32" else "install openssh-client"
|
||||||
|
msg = f"ERROR: ssh-keygen not found — {hint}"
|
||||||
log.error(msg)
|
log.error(msg)
|
||||||
return msg
|
return msg
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
|||||||
3
main.py
3
main.py
@@ -23,7 +23,7 @@ def _find_active_xauthority():
|
|||||||
xauth = os.path.join(entry.path, ".Xauthority")
|
xauth = os.path.join(entry.path, ".Xauthority")
|
||||||
if os.path.isfile(xauth):
|
if os.path.isfile(xauth):
|
||||||
return xauth
|
return xauth
|
||||||
except PermissionError:
|
except (PermissionError, FileNotFoundError):
|
||||||
pass
|
pass
|
||||||
# 3. Check /root/.Xauthority
|
# 3. Check /root/.Xauthority
|
||||||
root_xauth = "/root/.Xauthority"
|
root_xauth = "/root/.Xauthority"
|
||||||
@@ -105,6 +105,7 @@ from gui.app import App
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
if sys.platform != "win32":
|
||||||
_ensure_display_access()
|
_ensure_display_access()
|
||||||
app = App()
|
app = App()
|
||||||
app.mainloop()
|
app.mainloop()
|
||||||
|
|||||||
BIN
releases/ServerManager-v1.8.71-win-x64.exe
Normal file
BIN
releases/ServerManager-v1.8.71-win-x64.exe
Normal file
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
"""Version info for ServerManager."""
|
"""Version info for ServerManager."""
|
||||||
|
|
||||||
__version__ = "1.8.70"
|
__version__ = "1.8.71"
|
||||||
__app_name__ = "ServerManager"
|
__app_name__ = "ServerManager"
|
||||||
__author__ = "aibot777"
|
__author__ = "aibot777"
|
||||||
__description__ = "Desktop GUI for managing remote servers"
|
__description__ = "Desktop GUI for managing remote servers"
|
||||||
|
|||||||
Reference in New Issue
Block a user