@rainbow-robotics/muscat-plugin-kit 0.1.2-dev.33 → 0.1.2-dev.34
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/cli/docker/Dockerfile.python +1 -1
- package/cli/src/python.mjs +31 -17
- package/package.json +2 -2
|
@@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
9
9
|
python3 \
|
|
10
10
|
python3-pip \
|
|
11
11
|
&& rm -rf /var/lib/apt/lists/* \
|
|
12
|
-
&& pip3 install uv --break-system-packages
|
|
12
|
+
&& pip3 install uv==0.8.18 --break-system-packages
|
|
13
13
|
|
|
14
14
|
# TODO(cpp-sdk): the Python SDK is a pybind wrapper over the cpp SDK, so the
|
|
15
15
|
# cpp SDK shared lib must be present for the python module to load. Install the
|
package/cli/src/python.mjs
CHANGED
|
@@ -20,21 +20,23 @@ export function assertDockerReady() {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/** Build the dev image from the kit's bundled Dockerfile (Docker layer-caches). */
|
|
23
|
-
export function ensureImage(image = PYTHON_DEV_IMAGE) {
|
|
24
|
-
log.step(`docker build -t ${image} (first run is slow, then cached)…`);
|
|
23
|
+
export function ensureImage(image = PYTHON_DEV_IMAGE, { platform = null } = {}) {
|
|
24
|
+
log.step(`docker build -t ${image}${platform ? ` (${platform})` : ""} (first run is slow, then cached)…`);
|
|
25
|
+
const platformFlags = platform ? ["--platform", platform] : [];
|
|
25
26
|
const r = spawnSync(
|
|
26
27
|
"docker",
|
|
27
|
-
["build", "-t", image, "-f", DOCKERFILE, dirname(DOCKERFILE)],
|
|
28
|
+
["build", ...platformFlags, "-t", image, "-f", DOCKERFILE, dirname(DOCKERFILE)],
|
|
28
29
|
{ stdio: "inherit" },
|
|
29
30
|
);
|
|
30
31
|
if (r.status !== 0) throw new Error("docker build failed.");
|
|
31
32
|
pruneMuskatImages();
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
// Docker --platform 플래그: 컨테이너를 target arch로 띄우면
|
|
36
|
+
// pip이 glibc + arch를 자동 감지해 올바른 휠을 받는다.
|
|
37
|
+
const ARCH_DOCKER_PLATFORM = {
|
|
38
|
+
x86_64: "linux/amd64",
|
|
39
|
+
aarch64: "linux/arm64",
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
/**
|
|
@@ -73,24 +75,36 @@ export function lockAndVendor(pluginRoot, archs = ["x86_64", "aarch64"]) {
|
|
|
73
75
|
// 한 arch가 실패해도 나머지 arch는 계속 시도한다.
|
|
74
76
|
const failed = [];
|
|
75
77
|
for (const arch of archs) {
|
|
76
|
-
const
|
|
77
|
-
if (!
|
|
78
|
+
const dockerPlatform = ARCH_DOCKER_PLATFORM[arch];
|
|
79
|
+
if (!dockerPlatform) {
|
|
78
80
|
log.warn(`unknown arch '${arch}' — skipped`);
|
|
79
81
|
continue;
|
|
80
82
|
}
|
|
81
|
-
|
|
83
|
+
// arch별 이미지 빌드 (--platform 지정) → pip이 glibc+arch 자동 감지 → 올바른 휠 선택.
|
|
84
|
+
const archImage = `${PYTHON_DEV_IMAGE}-${arch}`;
|
|
85
|
+
ensureImage(archImage, { platform: dockerPlatform });
|
|
86
|
+
|
|
87
|
+
log.step(`vendoring wheels for ${arch} (${dockerPlatform})…`);
|
|
88
|
+
// 패키지별 개별 download로 private/미공개 패키지 실패 시에도 나머지 계속 진행.
|
|
89
|
+
const script = [
|
|
90
|
+
`set -e`,
|
|
91
|
+
`cd /plugin`,
|
|
92
|
+
`mkdir -p dist/wheels`,
|
|
93
|
+
`pkgs=$(grep -v '^#' dist/requirements.lock | grep -v '^[[:space:]]' | grep -v '^$')`,
|
|
94
|
+
`SKIP=""`,
|
|
95
|
+
`for pkg in $pkgs; do`,
|
|
96
|
+
` pip3 download "$pkg" --no-deps --only-binary=:all: -d dist/wheels -q 2>&1 || SKIP="$SKIP $pkg"`,
|
|
97
|
+
`done`,
|
|
98
|
+
`[ -z "$SKIP" ] || echo "WARN: no wheel found (package not on PyPI or missing binary wheel):$SKIP"`,
|
|
99
|
+
].join("\n");
|
|
82
100
|
const r = spawnSync(
|
|
83
101
|
"docker",
|
|
84
102
|
[
|
|
85
103
|
"run", "--rm",
|
|
104
|
+
"--platform", dockerPlatform,
|
|
86
105
|
"-v", `${pluginRoot}:/plugin`,
|
|
87
|
-
|
|
88
|
-
"bash", "-c",
|
|
89
|
-
`set -e && cd /plugin && mkdir -p dist/wheels && ` +
|
|
90
|
-
`python3 -m pip install -q --upgrade pip && ` +
|
|
91
|
-
`pip3 download -r dist/requirements.lock ` +
|
|
92
|
-
`--only-binary=:all: --platform ${platform} --python-version 312 --implementation cp ` +
|
|
93
|
-
`-d dist/wheels`,
|
|
106
|
+
archImage,
|
|
107
|
+
"bash", "-c", script,
|
|
94
108
|
],
|
|
95
109
|
{ stdio: "inherit" },
|
|
96
110
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rainbow-robotics/muscat-plugin-kit",
|
|
3
|
-
"version": "0.1.2-dev.
|
|
3
|
+
"version": "0.1.2-dev.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@types/react-dom": "^19.0.4"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@rainbow-robotics/preview-host": "0.1.2-dev.
|
|
34
|
+
"@rainbow-robotics/preview-host": "0.1.2-dev.34",
|
|
35
35
|
"socket.io": "^4.8.1"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|