pinokiod 1.2.11 → 1.2.13
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 +60 -58
- package/package.json +1 -1
package/kernel/shell.js
CHANGED
|
@@ -475,7 +475,6 @@ class Shell {
|
|
|
475
475
|
|
|
476
476
|
// 1. conda
|
|
477
477
|
|
|
478
|
-
let conda_activation = []
|
|
479
478
|
if (params.conda) {
|
|
480
479
|
|
|
481
480
|
// 1. conda_path/conda_name/conda_python
|
|
@@ -490,77 +489,80 @@ class Shell {
|
|
|
490
489
|
if (params.conda.skip) {
|
|
491
490
|
// do nothing
|
|
492
491
|
} else {
|
|
493
|
-
if (typeof conda === "string") {
|
|
494
|
-
conda_path = conda
|
|
492
|
+
if (typeof params.conda === "string") {
|
|
493
|
+
conda_path = params.conda
|
|
495
494
|
} else {
|
|
496
495
|
// conda_path
|
|
497
|
-
if (conda.path) {
|
|
498
|
-
conda_path = conda.path
|
|
499
|
-
} else if (conda.name) {
|
|
500
|
-
conda_name = conda.name
|
|
496
|
+
if (params.conda.path) {
|
|
497
|
+
conda_path = params.conda.path
|
|
498
|
+
} else if (params.conda.name) {
|
|
499
|
+
conda_name = params.conda.name
|
|
501
500
|
} else {
|
|
502
501
|
throw new Error("when specifying conda as an object, the conda.name or conda.path must exist")
|
|
503
502
|
}
|
|
504
503
|
|
|
505
504
|
// conda_python
|
|
506
|
-
if (conda.python) {
|
|
507
|
-
conda_python = conda.python
|
|
505
|
+
if (params.conda.python) {
|
|
506
|
+
conda_python = params.conda.python
|
|
508
507
|
}
|
|
509
508
|
}
|
|
510
509
|
}
|
|
511
510
|
}
|
|
511
|
+
} else {
|
|
512
|
+
conda_name = "base"
|
|
513
|
+
}
|
|
512
514
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
conda_activation = [
|
|
552
|
-
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
553
|
-
`conda create -y -n ${conda_name} ${conda_python}`,
|
|
554
|
-
`conda deactivate`,
|
|
555
|
-
`conda deactivate`,
|
|
556
|
-
`conda deactivate`,
|
|
557
|
-
`conda activate ${conda_name}`,
|
|
558
|
-
]
|
|
559
|
-
}
|
|
515
|
+
console.log("CONDA STEP 1", { conda: params.conda, conda_path, conda_name, conda_python })
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
// 2. conda_activation
|
|
519
|
+
let conda_activation = []
|
|
520
|
+
if (conda_path) {
|
|
521
|
+
let env_path = path.resolve(params.path, conda_path)
|
|
522
|
+
let env_exists = await this.exists(env_path)
|
|
523
|
+
if (env_exists) {
|
|
524
|
+
conda_activation = [
|
|
525
|
+
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
526
|
+
`conda deactivate`,
|
|
527
|
+
`conda deactivate`,
|
|
528
|
+
`conda deactivate`,
|
|
529
|
+
`conda activate ${env_path}`,
|
|
530
|
+
]
|
|
531
|
+
} else {
|
|
532
|
+
conda_activation = [
|
|
533
|
+
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
534
|
+
`conda create -y -p ${env_path} ${conda_python}`,
|
|
535
|
+
`conda deactivate`,
|
|
536
|
+
`conda deactivate`,
|
|
537
|
+
`conda deactivate`,
|
|
538
|
+
`conda activate ${env_path}`,
|
|
539
|
+
]
|
|
540
|
+
}
|
|
541
|
+
} else if (conda_name) {
|
|
542
|
+
let envs_path = this.kernel.bin.path("miniconda/envs")
|
|
543
|
+
let env_path = path.resolve(envs_path, conda_name)
|
|
544
|
+
let env_exists = await this.exists(env_path)
|
|
545
|
+
if (env_exists) {
|
|
546
|
+
conda_activation = [
|
|
547
|
+
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
548
|
+
`conda deactivate`,
|
|
549
|
+
`conda deactivate`,
|
|
550
|
+
`conda deactivate`,
|
|
551
|
+
`conda activate ${conda_name}`,
|
|
552
|
+
]
|
|
560
553
|
} else {
|
|
561
|
-
|
|
562
|
-
|
|
554
|
+
conda_activation = [
|
|
555
|
+
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
556
|
+
`conda create -y -n ${conda_name} ${conda_python}`,
|
|
557
|
+
`conda deactivate`,
|
|
558
|
+
`conda deactivate`,
|
|
559
|
+
`conda deactivate`,
|
|
560
|
+
`conda activate ${conda_name}`,
|
|
561
|
+
]
|
|
563
562
|
}
|
|
563
|
+
} else {
|
|
564
|
+
// no conda name or conda path => means don't activate any env
|
|
565
|
+
conda_activation = []
|
|
564
566
|
}
|
|
565
567
|
|
|
566
568
|
console.log("CONDA STEP 2", { conda_activation })
|