pinokiod 8.0.80 → 8.0.81
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/kernel/shell.js +7 -0
- package/package.json +1 -1
- package/test/shell-run-template.test.js +41 -0
package/kernel/shell.js
CHANGED
|
@@ -1263,6 +1263,13 @@ class Shell {
|
|
|
1263
1263
|
if (cuda_script) {
|
|
1264
1264
|
conda_activation.push(`CALL "${cuda_script}" > "${cuda_log}" 2>&1`)
|
|
1265
1265
|
}
|
|
1266
|
+
// The conda-forge VS activation script prepends Library\lib before
|
|
1267
|
+
// calling vcvars, but vcvars rebuilds LIB and drops that entry.
|
|
1268
|
+
// Restore both the active Conda environment and managed CUDA import
|
|
1269
|
+
// libraries after all compiler activation scripts have completed.
|
|
1270
|
+
// CALL's second expansion is required because these commands are
|
|
1271
|
+
// joined on one cmd.exe line and must read LIB after vcvars updates it.
|
|
1272
|
+
conda_activation.push(`CALL set "LIB=%%CONDA_PREFIX%%\\Library\\lib;%%CUDA_HOME%%\\lib;%%LIB%%"`)
|
|
1266
1273
|
} catch (e) {
|
|
1267
1274
|
console.log('vc vars setup', e)
|
|
1268
1275
|
}
|
package/package.json
CHANGED
|
@@ -174,6 +174,47 @@ test('Shell.activate keeps managed Python downloads automatic on every platform'
|
|
|
174
174
|
}
|
|
175
175
|
})
|
|
176
176
|
|
|
177
|
+
test('Shell.activate restores Conda and CUDA library paths after Windows compiler activation', async (t) => {
|
|
178
|
+
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'pinokio-shell-windows-lib-'))
|
|
179
|
+
t.after(() => fs.rm(root, { recursive: true, force: true }))
|
|
180
|
+
const activateRoot = path.join(root, 'bin', 'miniforge', 'etc', 'conda', 'activate.d', 'pinokio')
|
|
181
|
+
const compilerScript = path.join(activateRoot, 'vs2019_compiler_vars.bat')
|
|
182
|
+
const cudaScript = path.join(activateRoot, '~cuda-nvcc_activate.bat')
|
|
183
|
+
await fs.mkdir(activateRoot, { recursive: true })
|
|
184
|
+
await fs.writeFile(compilerScript, '@echo off\n')
|
|
185
|
+
await fs.writeFile(cudaScript, '@echo off\n')
|
|
186
|
+
|
|
187
|
+
const kernel = createKernel(root)
|
|
188
|
+
kernel.bin = {
|
|
189
|
+
activationCommands: () => [],
|
|
190
|
+
path: (...parts) => path.join(root, 'bin', ...parts),
|
|
191
|
+
vs_path_env: {},
|
|
192
|
+
}
|
|
193
|
+
const shell = createShell(kernel)
|
|
194
|
+
shell.platform = 'win32'
|
|
195
|
+
shell.shell = 'cmd.exe'
|
|
196
|
+
shell.env = {}
|
|
197
|
+
|
|
198
|
+
const params = await shell.activate({
|
|
199
|
+
build: true,
|
|
200
|
+
path: root,
|
|
201
|
+
message: ['uv pip install cupy'],
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
const activation = params.message[0]
|
|
205
|
+
const compilerIndex = activation.indexOf(`CALL "${compilerScript}"`)
|
|
206
|
+
const cudaIndex = activation.indexOf(`CALL "${cudaScript}"`)
|
|
207
|
+
const libraryCommand = 'CALL set "LIB=%%CONDA_PREFIX%%\\Library\\lib;%%CUDA_HOME%%\\lib;%%LIB%%"'
|
|
208
|
+
const libraryIndex = activation.indexOf(libraryCommand)
|
|
209
|
+
|
|
210
|
+
assert.notEqual(compilerIndex, -1)
|
|
211
|
+
assert.notEqual(cudaIndex, -1)
|
|
212
|
+
assert.notEqual(libraryIndex, -1)
|
|
213
|
+
assert.ok(compilerIndex < cudaIndex)
|
|
214
|
+
assert.ok(cudaIndex < libraryIndex)
|
|
215
|
+
assert.equal(params.message[1], 'uv pip install cupy')
|
|
216
|
+
})
|
|
217
|
+
|
|
177
218
|
test('Shell.init_env defaults the uv HTTP timeout without overriding apps', async () => {
|
|
178
219
|
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'pinokio-shell-uv-timeout-'))
|
|
179
220
|
await fs.mkdir(path.join(root, 'api'), { recursive: true })
|