@qpfai/pf-gate-cli 1.0.41-linux-arm64 → 1.0.41-win32-arm64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @qpfai/pf-gate-cli (linux-arm64)
1
+ # @qpfai/pf-gate-cli (win32-arm64)
2
2
 
3
3
  Platform runtime payload for PF Gate CLI.
4
4
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@qpfai/pf-gate-cli",
3
- "version": "1.0.41-linux-arm64",
4
- "description": "PF Gate runtime payload for linux arm64.",
3
+ "version": "1.0.41-win32-arm64",
4
+ "description": "PF Gate runtime payload for win32 arm64.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "os": [
8
- "linux"
8
+ "win32"
9
9
  ],
10
10
  "cpu": [
11
11
  "arm64"
@@ -0,0 +1,145 @@
1
+ @echo off
2
+ setlocal EnableExtensions EnableDelayedExpansion
3
+
4
+ set "SCRIPT_DIR=%~dp0"
5
+ set "BUNDLED_WHEEL=%SCRIPT_DIR%..\python\persons_field-1.0.0-py3-none-any.whl"
6
+ set "RUNTIME_HOME=%PF_GATE_RUNTIME_HOME%"
7
+ if "%RUNTIME_HOME%"=="" set "RUNTIME_HOME=%USERPROFILE%\.pf-gate\runtime"
8
+ set "WHEEL_STAMP_FILE="
9
+ if not "%RUNTIME_HOME%"=="" set "WHEEL_STAMP_FILE=%RUNTIME_HOME%\.bundled-wheel.sha256"
10
+ set "SYSTEM_PYTHON="
11
+ set "VENV_DIR="
12
+ set "IS_MANAGED_VENV=0"
13
+
14
+ set "PYTHON_BIN=%PF_GATE_PYTHON%"
15
+ if "%PYTHON_BIN%"=="" (
16
+ where python >nul 2>nul
17
+ if not errorlevel 1 (
18
+ set "SYSTEM_PYTHON=python"
19
+ ) else (
20
+ where py >nul 2>nul
21
+ if not errorlevel 1 (
22
+ set "SYSTEM_PYTHON=py -3"
23
+ )
24
+ )
25
+
26
+ if "%SYSTEM_PYTHON%"=="" (
27
+ echo PF Gate runtime error: Python 3.13+ not found. Install Python or set PF_GATE_PYTHON. 1>&2
28
+ exit /b 1
29
+ )
30
+
31
+ set "VENV_DIR=%RUNTIME_HOME%\.venv"
32
+ set "IS_MANAGED_VENV=1"
33
+ set "PYTHON_BIN=%VENV_DIR%\Scripts\python.exe"
34
+
35
+ if not exist "%PYTHON_BIN%" (
36
+ echo PF Gate runtime: creating runtime environment at %VENV_DIR% 1>&2
37
+ if not exist "%RUNTIME_HOME%" mkdir "%RUNTIME_HOME%"
38
+ call %SYSTEM_PYTHON% -m venv "%VENV_DIR%"
39
+ if errorlevel 1 (
40
+ echo PF Gate runtime error: failed to create runtime environment at %VENV_DIR% 1>&2
41
+ exit /b 1
42
+ )
43
+ )
44
+ )
45
+
46
+ set "PIP_TARGET=%PF_GATE_PIP_SPEC%"
47
+ if "%PIP_TARGET%"=="" set "PIP_TARGET=%BUNDLED_WHEEL%"
48
+ if "%PF_GATE_PIP_SPEC%"=="" (
49
+ if not exist "%BUNDLED_WHEEL%" (
50
+ echo PF Gate runtime error: missing bundled wheel at %BUNDLED_WHEEL% 1>&2
51
+ exit /b 1
52
+ )
53
+ )
54
+
55
+ set "BUNDLED_HASH="
56
+ if "%PF_GATE_PIP_SPEC%"=="" (
57
+ for /f "skip=1 tokens=* delims=" %%H in ('certutil -hashfile "%BUNDLED_WHEEL%" SHA256 ^| findstr /R /V /C:"hash of file" /C:"CertUtil"') do (
58
+ set "line=%%H"
59
+ set "line=!line: =!"
60
+ if not "!line!"=="" (
61
+ set "BUNDLED_HASH=!line!"
62
+ goto :hash_done
63
+ )
64
+ )
65
+ )
66
+ :hash_done
67
+
68
+ set "NEEDS_INSTALL=0"
69
+ set "FORCE_REINSTALL=0"
70
+ set "INSTALL_REASON=persons_field is missing"
71
+
72
+ call %PYTHON_BIN% -c "import persons_field.terminal.launcher" >nul 2>nul
73
+ if errorlevel 1 (
74
+ set "NEEDS_INSTALL=1"
75
+ ) else (
76
+ if "%PF_GATE_PIP_SPEC%"=="" if defined BUNDLED_HASH (
77
+ set "STORED_HASH="
78
+ if defined WHEEL_STAMP_FILE if exist "%WHEEL_STAMP_FILE%" (
79
+ set /p STORED_HASH=<"%WHEEL_STAMP_FILE%"
80
+ set "STORED_HASH=!STORED_HASH: =!"
81
+ )
82
+ if /I not "!STORED_HASH!"=="!BUNDLED_HASH!" (
83
+ set "NEEDS_INSTALL=1"
84
+ set "FORCE_REINSTALL=1"
85
+ set "INSTALL_REASON=bundled runtime payload changed"
86
+ )
87
+ )
88
+ )
89
+
90
+ if "%NEEDS_INSTALL%"=="1" (
91
+ echo PF Gate runtime: !INSTALL_REASON!; installing %PIP_TARGET%... 1>&2
92
+ set "FORCE_PIP_REINSTALL=%FORCE_REINSTALL%"
93
+ if "!FORCE_REINSTALL!"=="1" if "!IS_MANAGED_VENV!"=="1" (
94
+ echo PF Gate runtime: refreshing runtime environment at !VENV_DIR! 1>&2
95
+ if exist "!VENV_DIR!" rmdir /s /q "!VENV_DIR!"
96
+ if not exist "!RUNTIME_HOME!" mkdir "!RUNTIME_HOME!"
97
+ call !SYSTEM_PYTHON! -m venv "!VENV_DIR!"
98
+ if errorlevel 1 (
99
+ echo PF Gate runtime error: failed to refresh runtime environment at !VENV_DIR! 1>&2
100
+ exit /b 1
101
+ )
102
+ set "PYTHON_BIN=!VENV_DIR!\Scripts\python.exe"
103
+ set "FORCE_PIP_REINSTALL=0"
104
+ )
105
+ call %PYTHON_BIN% -m pip --version >nul 2>nul
106
+ if errorlevel 1 (
107
+ call %PYTHON_BIN% -m ensurepip --upgrade >nul 2>nul
108
+ )
109
+
110
+ if "!FORCE_PIP_REINSTALL!"=="1" (
111
+ call %PYTHON_BIN% -m pip install --upgrade --force-reinstall --disable-pip-version-check "%PIP_TARGET%"
112
+ if errorlevel 1 (
113
+ if "!IS_MANAGED_VENV!"=="1" (
114
+ echo PF Gate runtime error: failed to install %PIP_TARGET%. Set PF_GATE_PYTHON and PF_GATE_PIP_SPEC, then retry. 1>&2
115
+ exit /b 1
116
+ )
117
+ call %PYTHON_BIN% -m pip install --user --upgrade --force-reinstall --disable-pip-version-check "%PIP_TARGET%"
118
+ if errorlevel 1 (
119
+ echo PF Gate runtime error: failed to install %PIP_TARGET%. Set PF_GATE_PYTHON and PF_GATE_PIP_SPEC, then retry. 1>&2
120
+ exit /b 1
121
+ )
122
+ )
123
+ ) else (
124
+ call %PYTHON_BIN% -m pip install --upgrade --disable-pip-version-check "%PIP_TARGET%"
125
+ if errorlevel 1 (
126
+ if "!IS_MANAGED_VENV!"=="1" (
127
+ echo PF Gate runtime error: failed to install %PIP_TARGET%. Set PF_GATE_PYTHON and PF_GATE_PIP_SPEC, then retry. 1>&2
128
+ exit /b 1
129
+ )
130
+ call %PYTHON_BIN% -m pip install --user --upgrade --disable-pip-version-check "%PIP_TARGET%"
131
+ if errorlevel 1 (
132
+ echo PF Gate runtime error: failed to install %PIP_TARGET%. Set PF_GATE_PYTHON and PF_GATE_PIP_SPEC, then retry. 1>&2
133
+ exit /b 1
134
+ )
135
+ )
136
+ )
137
+ )
138
+
139
+ if "%PF_GATE_PIP_SPEC%"=="" if defined BUNDLED_HASH if defined WHEEL_STAMP_FILE (
140
+ if not exist "%RUNTIME_HOME%" mkdir "%RUNTIME_HOME%"
141
+ >"%WHEEL_STAMP_FILE%" echo %BUNDLED_HASH%
142
+ )
143
+
144
+ call %PYTHON_BIN% -m persons_field.terminal.launcher %*
145
+ exit /b %ERRORLEVEL%
@@ -1,165 +0,0 @@
1
- #!/usr/bin/env sh
2
- set -eu
3
-
4
- SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
5
- BUNDLED_WHEEL="$SCRIPT_DIR/../python/persons_field-1.0.0-py3-none-any.whl"
6
- USER_HOME="${HOME:-}"
7
- RUNTIME_HOME="${PF_GATE_RUNTIME_HOME:-}"
8
- if [ -z "$RUNTIME_HOME" ] && [ -n "$USER_HOME" ]; then
9
- RUNTIME_HOME="$USER_HOME/.pf-gate/runtime"
10
- fi
11
- WHEEL_STAMP_FILE=""
12
- if [ -n "$RUNTIME_HOME" ]; then
13
- WHEEL_STAMP_FILE="$RUNTIME_HOME/.bundled-wheel.sha256"
14
- fi
15
- SYSTEM_PYTHON=""
16
- VENV_DIR=""
17
- IS_MANAGED_VENV=0
18
-
19
- resolve_system_python() {
20
- if command -v python3 >/dev/null 2>&1; then
21
- printf '%s' "python3"
22
- return 0
23
- fi
24
- if command -v python >/dev/null 2>&1; then
25
- printf '%s' "python"
26
- return 0
27
- fi
28
- return 1
29
- }
30
-
31
- sha256_file() {
32
- file_path="$1"
33
- if command -v shasum >/dev/null 2>&1; then
34
- shasum -a 256 "$file_path" | awk '{print $1}'
35
- return 0
36
- fi
37
- if command -v sha256sum >/dev/null 2>&1; then
38
- sha256sum "$file_path" | awk '{print $1}'
39
- return 0
40
- fi
41
- if command -v openssl >/dev/null 2>&1; then
42
- openssl dgst -sha256 "$file_path" | awk '{print $NF}'
43
- return 0
44
- fi
45
- return 1
46
- }
47
-
48
- read_wheel_stamp() {
49
- if [ -z "$WHEEL_STAMP_FILE" ] || [ ! -f "$WHEEL_STAMP_FILE" ]; then
50
- return 0
51
- fi
52
- head -n 1 "$WHEEL_STAMP_FILE" 2>/dev/null || true
53
- }
54
-
55
- write_wheel_stamp() {
56
- wheel_hash="$1"
57
- if [ -z "$WHEEL_STAMP_FILE" ] || [ -z "$wheel_hash" ]; then
58
- return 0
59
- fi
60
- mkdir -p "$(dirname "$WHEEL_STAMP_FILE")"
61
- printf '%s\n' "$wheel_hash" >"$WHEEL_STAMP_FILE" || true
62
- }
63
-
64
- PYTHON_BIN="${PF_GATE_PYTHON:-}"
65
- if [ -z "$PYTHON_BIN" ]; then
66
- SYSTEM_PYTHON="$(resolve_system_python || true)"
67
- if [ -z "$SYSTEM_PYTHON" ]; then
68
- echo "PF Gate runtime error: Python 3.13+ not found. Install Python or set PF_GATE_PYTHON." >&2
69
- exit 1
70
- fi
71
-
72
- if [ -z "$USER_HOME" ] && [ -z "${PF_GATE_RUNTIME_HOME:-}" ]; then
73
- echo "PF Gate runtime error: HOME is not set. Set PF_GATE_RUNTIME_HOME or PF_GATE_PYTHON." >&2
74
- exit 1
75
- fi
76
-
77
- if [ -z "$RUNTIME_HOME" ]; then
78
- RUNTIME_HOME="$USER_HOME/.pf-gate/runtime"
79
- fi
80
- VENV_DIR="$RUNTIME_HOME/.venv"
81
- IS_MANAGED_VENV=1
82
- PYTHON_BIN="$VENV_DIR/bin/python"
83
-
84
- if [ ! -x "$PYTHON_BIN" ]; then
85
- echo "PF Gate runtime: creating runtime environment at $VENV_DIR" >&2
86
- mkdir -p "$RUNTIME_HOME"
87
- if ! "$SYSTEM_PYTHON" -m venv "$VENV_DIR"; then
88
- echo "PF Gate runtime error: failed to create runtime environment at $VENV_DIR" >&2
89
- exit 1
90
- fi
91
- fi
92
- fi
93
-
94
- PIP_TARGET="${PF_GATE_PIP_SPEC:-$BUNDLED_WHEEL}"
95
- if [ -z "${PF_GATE_PIP_SPEC:-}" ] && [ ! -f "$BUNDLED_WHEEL" ]; then
96
- echo "PF Gate runtime error: missing bundled wheel at $BUNDLED_WHEEL" >&2
97
- exit 1
98
- fi
99
-
100
- BUNDLED_HASH=""
101
- if [ -z "${PF_GATE_PIP_SPEC:-}" ] && [ -f "$BUNDLED_WHEEL" ]; then
102
- BUNDLED_HASH="$(sha256_file "$BUNDLED_WHEEL" 2>/dev/null || true)"
103
- fi
104
-
105
- NEEDS_INSTALL=0
106
- FORCE_REINSTALL=0
107
- INSTALL_REASON="persons_field is missing"
108
- if ! "$PYTHON_BIN" -c "import persons_field.terminal.launcher" >/dev/null 2>&1; then
109
- NEEDS_INSTALL=1
110
- elif [ -z "${PF_GATE_PIP_SPEC:-}" ] && [ -n "$BUNDLED_HASH" ]; then
111
- STORED_HASH="$(read_wheel_stamp)"
112
- if [ "$STORED_HASH" != "$BUNDLED_HASH" ]; then
113
- NEEDS_INSTALL=1
114
- FORCE_REINSTALL=1
115
- INSTALL_REASON="bundled runtime payload changed"
116
- fi
117
- fi
118
-
119
- if [ "$NEEDS_INSTALL" -eq 1 ]; then
120
- echo "PF Gate runtime: ${INSTALL_REASON}; installing ${PIP_TARGET}..." >&2
121
- FORCE_PIP_REINSTALL="$FORCE_REINSTALL"
122
- if [ "$FORCE_REINSTALL" -eq 1 ] && [ "$IS_MANAGED_VENV" -eq 1 ] && [ -n "$SYSTEM_PYTHON" ] && [ -n "$VENV_DIR" ]; then
123
- echo "PF Gate runtime: refreshing runtime environment at $VENV_DIR" >&2
124
- rm -rf "$VENV_DIR"
125
- mkdir -p "$RUNTIME_HOME"
126
- if ! "$SYSTEM_PYTHON" -m venv "$VENV_DIR"; then
127
- echo "PF Gate runtime error: failed to refresh runtime environment at $VENV_DIR" >&2
128
- exit 1
129
- fi
130
- PYTHON_BIN="$VENV_DIR/bin/python"
131
- FORCE_PIP_REINSTALL=0
132
- fi
133
- if ! "$PYTHON_BIN" -m pip --version >/dev/null 2>&1; then
134
- "$PYTHON_BIN" -m ensurepip --upgrade >/dev/null 2>&1 || true
135
- fi
136
- if [ "$FORCE_PIP_REINSTALL" -eq 1 ]; then
137
- if ! "$PYTHON_BIN" -m pip install --upgrade --force-reinstall --disable-pip-version-check "$PIP_TARGET"; then
138
- if [ "$IS_MANAGED_VENV" -eq 1 ]; then
139
- echo "PF Gate runtime error: failed to install ${PIP_TARGET}. Set PF_GATE_PYTHON and PF_GATE_PIP_SPEC, then retry." >&2
140
- exit 1
141
- fi
142
- if ! "$PYTHON_BIN" -m pip install --user --upgrade --force-reinstall --disable-pip-version-check "$PIP_TARGET"; then
143
- echo "PF Gate runtime error: failed to install ${PIP_TARGET}. Set PF_GATE_PYTHON and PF_GATE_PIP_SPEC, then retry." >&2
144
- exit 1
145
- fi
146
- fi
147
- else
148
- if ! "$PYTHON_BIN" -m pip install --upgrade --disable-pip-version-check "$PIP_TARGET"; then
149
- if [ "$IS_MANAGED_VENV" -eq 1 ]; then
150
- echo "PF Gate runtime error: failed to install ${PIP_TARGET}. Set PF_GATE_PYTHON and PF_GATE_PIP_SPEC, then retry." >&2
151
- exit 1
152
- fi
153
- if ! "$PYTHON_BIN" -m pip install --user --upgrade --disable-pip-version-check "$PIP_TARGET"; then
154
- echo "PF Gate runtime error: failed to install ${PIP_TARGET}. Set PF_GATE_PYTHON and PF_GATE_PIP_SPEC, then retry." >&2
155
- exit 1
156
- fi
157
- fi
158
- fi
159
- fi
160
-
161
- if [ -z "${PF_GATE_PIP_SPEC:-}" ] && [ -n "$BUNDLED_HASH" ]; then
162
- write_wheel_stamp "$BUNDLED_HASH"
163
- fi
164
-
165
- exec "$PYTHON_BIN" -m persons_field.terminal.launcher "$@"