Skip to content

Commit aa19a8b

Browse files
committed
feat: update runtime paths and add bundled modules support
1 parent 4ec01fe commit aa19a8b

13 files changed

Lines changed: 465 additions & 157 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# macOS
2+
.DS_Store
3+
14
# Byte-compiled / optimized / DLL files
25
__pycache__/
36
*.py[cod]

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ bun run build
2424

2525
```text
2626
runtime/
27-
python31211/
27+
python/
28+
python.exe
29+
DLLs/
30+
Lib/
31+
Scripts/pip.exe
32+
git/
33+
bin/git.exe
2834
modules/
2935
MaiBot/
3036
MaiBot-Napcat-Adapter/

docs/release.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
2. 准备 release payload。仓库根目录必须存在:
1414

1515
```text
16-
runtime/python31211/bin/python.exe
16+
runtime/python/python.exe
17+
runtime/python/DLLs/
18+
runtime/python/Lib/
19+
runtime/python/Scripts/pip.exe
20+
runtime/git/bin/git.exe
1721
modules/MaiBot/bot.py
1822
modules/napcat/NapCatWinBootMain.exe
1923
```

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"nsis": {
9494
"oneClick": false,
9595
"perMachine": false,
96+
"include": "installer.nsh",
9697
"allowToChangeInstallationDirectory": true,
9798
"createDesktopShortcut": true,
9899
"createStartMenuShortcut": true,

resources/installer.nsh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
!macro customHeader
2+
ShowInstDetails show
3+
!ifdef BUILD_UNINSTALLER
4+
ShowUninstDetails show
5+
!endif
6+
!macroend

scripts/release/check-windows-payload.ts

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,44 @@ const requirements: Requirement[] = [
3232
candidates: [dir("runtime")],
3333
},
3434
{
35-
label: "embedded Python",
35+
label: "portable Python directory",
3636
required: true,
37-
candidates: [file("runtime/python31211/bin/python.exe"), file("runtime/python31211/python.exe")],
37+
candidates: [dir("runtime/python")],
38+
},
39+
{
40+
label: "portable Python executable",
41+
required: true,
42+
candidates: [file("runtime/python/python.exe"), file("runtime/python/bin/python.exe")],
43+
},
44+
{
45+
label: "portable Python standard library",
46+
required: true,
47+
candidates: [dir("runtime/python/Lib"), dir("runtime/python/lib")],
48+
},
49+
{
50+
label: "portable Python extension modules",
51+
required: true,
52+
candidates: [dir("runtime/python/DLLs")],
53+
},
54+
{
55+
label: "portable Python pip command",
56+
required: true,
57+
candidates: [file("runtime/python/Scripts/pip.exe"), file("runtime/python/bin/pip")],
58+
},
59+
{
60+
label: "portable Python pip package",
61+
required: true,
62+
candidates: [dir("runtime/python/Lib/site-packages/pip"), dir("runtime/python/lib/site-packages/pip")],
63+
},
64+
{
65+
label: "embedded Git directory",
66+
required: true,
67+
candidates: [dir("runtime/git")],
68+
},
69+
{
70+
label: "embedded Git executable",
71+
required: true,
72+
candidates: [file("runtime/git/bin/git.exe"), file("runtime/git/cmd/git.exe"), file("runtime/git/git.exe")],
3873
},
3974
{
4075
label: "modules directory",

src/main/pty/pty-session-manager.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ function resolveDefaultCwd(cwd: string | undefined): string {
6666
}
6767
}
6868

69-
function quoteForCmd(value: string): string {
70-
if (!/[ \t&()^|<>"]/.test(value)) {
71-
return value;
72-
}
73-
74-
return `"${value.replace(/"/g, '\\"')}"`;
75-
}
76-
7769
interface ResolvedCommand {
7870
file: string;
7971
args: string[];
@@ -133,10 +125,9 @@ function resolveCommand(request: PtyStartRequest, encoding: PtyEncoding): Resolv
133125

134126
if (requestedCommand && requestedCommand.length > 0) {
135127
if (process.platform === "win32") {
136-
const commandLine = requestedCommand.map(quoteForCmd).join(" ");
137128
return {
138-
file: process.env.ComSpec ?? "cmd.exe",
139-
args: ["/D", "/S", "/C", `chcp ${codePage} > nul & ${commandLine}`],
129+
file: requestedCommand[0],
130+
args: requestedCommand.slice(1),
140131
displayCommand: requestedCommand,
141132
title: request.title ?? basename(requestedCommand[0]),
142133
};

0 commit comments

Comments
 (0)