fix(sdk): shorten bundled Python resource paths on Windows
This commit is contained in:
1 parent
9d66716e50
commit
defb9c3736
19 files changed
+63
-38
No files matched your search
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write python/sdk-runtime/README.md
|
||||
README.md: a767bcea00a5bb116fdf25a4d1d8fd916f94c5f5
|
||||
README.zh.md: 539fae9f4f71df394bde54814b5190ea73126474
|
||||
README.md: 202af65986ae2c78aeb092f0b4adb88cd1c97e9b
|
||||
README.zh.md: 12ff0dbac184f67f8e821b6fbb9e22748563babb
|
||||
@@ -12,7 +12,7 @@ Production executables are named `deepseek-harness-sdk-runtime-<platform>-<arch>
|
||||
|
||||
Each target also requires `<executable-stem>-office/`, where the stem excludes `.exe`. This directory contains the complete installed Office packages and their dependencies, preserving engine resources, manifests, licenses, source inventories, and helper permissions. Copy this directory together with the executable. A missing target engine fails the sidecar build with its npm package name and target platform/architecture.
|
||||
|
||||
Each wheel also includes `<executable-stem>-resources/primary-runtime/` (CPython and the locked Office Python libraries) and sibling `office-skills/` (three default workflows and their shared checker). These are ordinary relocatable files, not bytes embedded in the executable. The shared builder selects target-native archives for all five wheel targets and executes its smoke on the native build host. Packaging and installed-runtime lookup reject missing resources, wrong-platform metadata, and lost Python executable permissions.
|
||||
Each wheel also includes `<platform>-<arch>/primary-runtime/` (CPython and the locked Office Python libraries) and sibling `office-skills/` (three default workflows and their shared checker). These are ordinary relocatable files, not bytes embedded in the executable. The shared builder selects target-native archives for all five wheel targets and executes its smoke on the native build host. Packaging and installed-runtime lookup reject missing resources, wrong-platform metadata, and lost Python executable permissions. The short platform directory avoids repeating the executable name in Python DLL paths on Windows.
|
||||
|
||||
The packaged bootstrap supplies `DSH_BUNDLED_PRIMARY_RUNTIME` as a carrier default. The `sdk` profile uses it when `DSH_PRIMARY_RUNTIME` is unset; an explicit path overrides it, and an empty string disables the query and Office provider. External payloads retain the `primary-runtime/` plus sibling `office-skills/` layout. The SDK reads Python in place without copying it into `DSH_HOME`. Source and dev-only Node carriers have no bundled default; they use an explicit `DSH_PRIMARY_RUNTIME`.
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ wheel 包会安装 `dsh` 控制台命令和 `deepseek_harness_runtime` Python
|
||||
|
||||
每个目标还要求 `<executable-stem>-office/`,其中 stem 不含 `.exe`。该目录包含完整的已安装 Office 包及其依赖,保留引擎资源、清单、许可证、源码清单与辅助程序权限。复制可执行文件时必须一并复制此目录。缺少目标引擎会使 sidecar 构建失败,错误会指出其 npm 包名与目标平台/架构。
|
||||
|
||||
每个 wheel 还包含 `<executable-stem>-resources/primary-runtime/`(CPython 与锁定版本的 Office Python 库)及同级 `office-skills/`(三个默认工作流与共用检查脚本)。它们是可重定位的普通文件,不嵌入可执行文件。共享构建器为全部五个 wheel 目标选择原生归档,并在对应构建主机上执行冒烟检查。打包与已安装运行时定位会拒绝缺失资源、平台不符的元数据及 Python 执行权限丢失。
|
||||
每个 wheel 还包含 `<platform>-<arch>/primary-runtime/`(CPython 与锁定版本的 Office Python 库)及同级 `office-skills/`(三个默认工作流与共用检查脚本)。它们是可重定位的普通文件,不嵌入可执行文件。共享构建器为全部五个 wheel 目标选择原生归档,并在对应构建主机上执行冒烟检查。打包与已安装运行时定位会拒绝缺失资源、平台不符的元数据及 Python 执行权限丢失。 较短的平台目录避免在 Windows Python DLL 路径中重复可执行文件名称。
|
||||
|
||||
打包启动器通过 `DSH_BUNDLED_PRIMARY_RUNTIME` 提供载体默认路径。`sdk` profile 在未设置 `DSH_PRIMARY_RUNTIME` 时使用该路径;显式路径覆盖它,空字符串禁用查询与 Office 提供方。外部 payload 保持 `primary-runtime/` 与同级 `office-skills/` 布局。SDK 原位读取 Python,不复制到 `DSH_HOME`。源码与仅供开发的 Node 载体没有随包默认路径,需显式设置 `DSH_PRIMARY_RUNTIME`。
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class RuntimeBuildHook(BuildHookInterface):
|
||||
target = next(name for name, value in _PLATFORMS.items() if value[0] == platform_tag)
|
||||
runtime_dir = Path(self.root) / "src" / "deepseek_harness_runtime" / "runtime"
|
||||
runtime_files = sorted(
|
||||
runtime_dir.glob("deepseek-harness-sdk-runtime-*") if runtime_dir.is_dir() else []
|
||||
(path for path in runtime_dir.iterdir() if path.name != "node") if runtime_dir.is_dir() else []
|
||||
)
|
||||
expected_files = (
|
||||
[expected_executable, f"{expected_executable.removesuffix('.exe')}-rg.exe"]
|
||||
@@ -88,7 +88,7 @@ class RuntimeBuildHook(BuildHookInterface):
|
||||
expected_files.append(f"{expected_executable}-spawn-helper")
|
||||
office = runtime_dir / f"{expected_executable.removesuffix('.exe')}-office"
|
||||
expected_files.append(office.name)
|
||||
resources = runtime_dir / f"{expected_executable.removesuffix('.exe')}-resources"
|
||||
resources = runtime_dir / target
|
||||
expected_files.append(resources.name)
|
||||
expected_files.sort()
|
||||
found_files = [path.name for path in runtime_files]
|
||||
|
||||
@@ -22,7 +22,13 @@ dsh = "deepseek_harness_runtime:main"
|
||||
|
||||
# Include the injected dsh executable and sidecars; exclude the dev-only node closure.
|
||||
[tool.hatch.build]
|
||||
artifacts = ["src/deepseek_harness_runtime/runtime/deepseek-harness-sdk-runtime-*", "src/deepseek_harness_runtime/runtime/deepseek-harness-sdk-runtime-*/**"]
|
||||
artifacts = [
|
||||
"src/deepseek_harness_runtime/runtime/deepseek-harness-sdk-runtime-*",
|
||||
"src/deepseek_harness_runtime/runtime/deepseek-harness-sdk-runtime-*/**",
|
||||
"src/deepseek_harness_runtime/runtime/linux-*/**",
|
||||
"src/deepseek_harness_runtime/runtime/macos-*/**",
|
||||
"src/deepseek_harness_runtime/runtime/win-*/**",
|
||||
]
|
||||
exclude = ["src/deepseek_harness_runtime/runtime/node"]
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
/** Private entry owned by the Python single-file runtime packaging. */
|
||||
import { registerHooks } from 'node:module'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { isSea } from 'node:sea'
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url'
|
||||
|
||||
@@ -30,7 +31,8 @@ if (aclRunner !== undefined && process.argv[2] === aclRunner) {
|
||||
} else if (selection === undefined) {
|
||||
if (isSea()) {
|
||||
// Carrier default stays separate so process/home environment and profile patches can override it.
|
||||
process.env.DSH_BUNDLED_PRIMARY_RUNTIME = `${process.execPath.replace(/\.exe$/i, '')}-resources/primary-runtime`
|
||||
const platform = process.platform === 'darwin' ? 'macos' : process.platform === 'win32' ? 'win' : process.platform
|
||||
process.env.DSH_BUNDLED_PRIMARY_RUNTIME = join(dirname(process.execPath), `${platform}-${process.arch}`, 'primary-runtime')
|
||||
}
|
||||
const { runCli } = await import('@deepseek-ai/dsh/lib/bin.js')
|
||||
await runCli()
|
||||
|
||||
@@ -107,7 +107,7 @@ def bundled_runtime_path() -> Path:
|
||||
f"deepseek-harness-runtime-bin is missing the Office sidecar engine {engine} at {office}. "
|
||||
+ _EXE_ACQUISITION_HINT
|
||||
)
|
||||
validate_resources(path.with_name(f"{path.name.removesuffix('.exe')}-resources"), tag)
|
||||
validate_resources(path.with_name(tag), tag)
|
||||
return path
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user