feat: put ncp on PATH on both platforms; rename WSL reqs to Windows
Ports the ncp PATH work from upstream. Registering ncp as a shell-profile function failed three ways on Windows: the default Restricted execution policy blocks the profile itself, profiles don't exist outside PowerShell (cmd, Win+R, Task Scheduler), and the self-elevating installer writes the admin's profile. Windows now ships management/ncp.cmd and the installer appends management\ to the Machine PATH via [Environment]::SetEnvironmentVariable -- never setx, which truncates PATH at 1024 chars. A .cmd is exempt from the execution policy. Linux symlinks /usr/local/bin/ncp -> management/nexus-cli.sh, falling back to the old .bashrc function when sudo is unavailable. Also renames requirements-wsl.txt to requirements-windows.txt and purges stale WSL references, including vite.config.js's dev-server comment and controlpanel.py's "Check WSLg." error string. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -80,7 +80,7 @@ class NexusControlPanel:
|
||||
self.root = root
|
||||
|
||||
if os.name != 'nt' and not os.environ.get('DISPLAY'):
|
||||
print("ERROR: No DISPLAY variable. Check WSLg.")
|
||||
print("ERROR: No DISPLAY variable. Is an X session running?")
|
||||
sys.exit(1)
|
||||
|
||||
self.root.title("Nexus Control Panel")
|
||||
@@ -91,7 +91,7 @@ class NexusControlPanel:
|
||||
print(f"Icon load failed: {e}")
|
||||
|
||||
if not sys.platform.startswith("linux"):
|
||||
# Keep the custom borderless titlebar on Windows/WSL,
|
||||
# Keep the custom borderless titlebar on Windows,
|
||||
# but allow normal stacking on Linux Mint.
|
||||
self.root.overrideredirect(True)
|
||||
self.root.configure(background="#1e1e1e")
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
@echo off
|
||||
REM ncp - PATH entry point on Windows. A .cmd, not a .ps1, on purpose: PowerShell's
|
||||
REM execution policy governs .ps1 only, so this keeps working under the default
|
||||
REM Restricted policy and from cmd, Win+R, Task Scheduler and .lnk targets - none
|
||||
REM of which load a PowerShell profile. install-windows.ps1 puts this directory on
|
||||
REM the machine PATH. ncp.ps1 stays for pwsh-on-Linux, where there is no PATH shim.
|
||||
REM
|
||||
REM ASCII only, same rule as the .ps1 files - a test in tests/test_smoke.py enforces it.
|
||||
setlocal
|
||||
set "ROOT=%~dp0.."
|
||||
REM System Python fallback so backup/restore work before the venv exists; those
|
||||
REM delegate to the stdlib-only bin/sync.py. Mirrors the same fallback in ncp.ps1.
|
||||
set "PY=%ROOT%\Promethean\Scripts\python.exe"
|
||||
if not exist "%PY%" set "PY=python"
|
||||
"%PY%" "%ROOT%\management\ncp.py" %*
|
||||
exit /b %ERRORLEVEL%
|
||||
+4
-2
@@ -2,8 +2,10 @@
|
||||
# file the Linux shell wrapper runs; this only picks an interpreter and forwards
|
||||
# the arguments.
|
||||
#
|
||||
# Windows: install-windows.ps1 registers this automatically. To do it by hand,
|
||||
# or to get ncp inside PowerShell on Linux, add to $PROFILE.CurrentUserAllHosts:
|
||||
# On Windows, ncp comes from management/ncp.cmd on the machine PATH instead (a
|
||||
# .cmd is not subject to the execution policy and works outside PowerShell too) -
|
||||
# install-windows.ps1 sets that up. This file is what gives ncp to pwsh on Linux,
|
||||
# where restore-linux.sh registers it in $PROFILE.CurrentUserAllHosts as:
|
||||
#
|
||||
# function ncp { & "<repo>/management/ncp.ps1" @args }
|
||||
#
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ bin/restore-linux.sh, controlpanel.py, nexus-popup.py and nexus-app.sh all keep
|
||||
calling what they always called.
|
||||
|
||||
psutil does the process work (cmdlines, pattern sweeps, port owners). It is
|
||||
declared in requirements-base.txt AND requirements-wsl.txt, so both boxes have
|
||||
declared in requirements-base.txt AND requirements-windows.txt, so both boxes have
|
||||
it - but it is imported lazily so `ncp backup`/`restore` still run before the
|
||||
venv exists, exactly as they did when they shelled out to sync.py.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user