pinokiod 3.2.215 → 3.2.217

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 CHANGED
@@ -488,6 +488,10 @@ class Shell {
488
488
  // - if object => the conda.path is the path => create if doesn't exist yet
489
489
  // 2. then process venv
490
490
 
491
+ const isNumber = (value) => {
492
+ return !isNaN(Number(value)) && isFinite(Number(value));
493
+ }
494
+
491
495
 
492
496
  // 1. conda
493
497
  let conda_path
@@ -525,7 +529,17 @@ class Shell {
525
529
 
526
530
  // conda_python
527
531
  if (params.conda.python) {
528
- conda_python = params.conda.python
532
+ if (isNumber(params.conda.python)) {
533
+ conda_python = "python=" + params.conda.python
534
+ } else {
535
+ conda_python = params.conda.python
536
+ }
537
+ } else if (params.conda_python) {
538
+ if (isNumber(params.conda_python)) {
539
+ conda_python = "python=" + params.conda_python
540
+ } else {
541
+ conda_python = params.conda_python
542
+ }
529
543
  }
530
544
  }
531
545
  }
@@ -664,27 +678,92 @@ class Shell {
664
678
  }
665
679
 
666
680
  // 2. venv
681
+
682
+ /*
683
+ {
684
+ method: ...,
685
+ params: ...,
686
+ venv: <path_string>
687
+ }
688
+
689
+ or
690
+
691
+ {
692
+ method: ...,
693
+ params: ...,
694
+ venv: {
695
+ path: <path_string>,
696
+ python: <python version>
697
+ }
698
+
699
+ or
700
+
701
+ {
702
+ method: ...,
703
+ params: ...,
704
+ venv: <path_string>,
705
+ venv_python: <python version>
706
+ }
707
+
708
+ */
667
709
  let venv_activation
668
710
  if (params.venv) {
669
- let env_path = path.resolve(params.path, params.venv)
670
- let activate_path = (this.platform === 'win32' ? path.resolve(env_path, "Scripts", "activate") : path.resolve(env_path, "bin", "activate"))
671
- let deactivate_path = (this.platform === 'win32' ? path.resolve(env_path, "Scripts", "deactivate") : "deactivate")
672
- let env_exists = await this.exists(env_path)
673
- if (env_exists) {
674
- venv_activation = [
675
- (this.platform === "win32" ? `${activate_path} ${env_path}` : `source ${activate_path} ${env_path}`),
676
- timeout,
677
- ]
711
+ let env_path
712
+ let python_version = ""
713
+ let use_uv = false
714
+ if (typeof params.venv === "string") {
715
+ env_path = path.resolve(params.path, params.venv)
716
+ if (params.venv_python) {
717
+ if (isNumber(params.venv_python)) {
718
+ python_version = ` --python ${params.venv_python}`
719
+ use_uv = true
720
+ }
721
+ }
722
+ } else if (typeof params.venv === "object" && params.venv.path) {
723
+ env_path = path.resolve(params.path, params.venv.path)
724
+ if (params.venv.python) {
725
+ if (isNumber(params.venv.python)) {
726
+ python_version = ` --python ${params.venv.python}`
727
+ use_uv = true
728
+ }
729
+ }
730
+ }
731
+ if (env_path) {
732
+ let activate_path = (this.platform === 'win32' ? path.resolve(env_path, "Scripts", "activate") : path.resolve(env_path, "bin", "activate"))
733
+ let deactivate_path = (this.platform === 'win32' ? path.resolve(env_path, "Scripts", "deactivate") : "deactivate")
734
+ let env_exists = await this.exists(env_path)
735
+ if (env_exists) {
736
+ venv_activation = [
737
+ (this.platform === "win32" ? `${activate_path} ${env_path}` : `source ${activate_path} ${env_path}`),
738
+ timeout,
739
+ ]
740
+ } else {
741
+ if (use_uv) {
742
+ // when python version is specified as venv.python => use uv
743
+ venv_activation = [
744
+ `uv venv ${env_path}${python_version}`
745
+ (this.platform === "win32" ? `${activate_path} ${env_path}` : `source ${activate_path} ${env_path}`),
746
+ `python -m pip install --upgrade pip setuptools wheel`,
747
+ deactivate_path,
748
+ timeout,
749
+ (this.platform === "win32" ? `${activate_path} ${env_path}` : `source ${activate_path} ${env_path}`),
750
+ timeout,
751
+ ]
752
+ } else {
753
+ // when python version is not specified, use the default python -m venv
754
+ venv_activation = [
755
+ `python -m venv ${env_path}`,
756
+ (this.platform === "win32" ? `${activate_path} ${env_path}` : `source ${activate_path} ${env_path}`),
757
+ `python -m pip install --upgrade pip setuptools wheel`,
758
+ deactivate_path,
759
+ timeout,
760
+ (this.platform === "win32" ? `${activate_path} ${env_path}` : `source ${activate_path} ${env_path}`),
761
+ timeout,
762
+ ]
763
+ }
764
+ }
678
765
  } else {
679
- venv_activation = [
680
- `python -m venv ${env_path}`,
681
- (this.platform === "win32" ? `${activate_path} ${env_path}` : `source ${activate_path} ${env_path}`),
682
- `python -m pip install --upgrade pip setuptools wheel`,
683
- deactivate_path,
684
- timeout,
685
- (this.platform === "win32" ? `${activate_path} ${env_path}` : `source ${activate_path} ${env_path}`),
686
- timeout,
687
- ]
766
+ venv_activation = []
688
767
  }
689
768
  } else {
690
769
  venv_activation = []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.2.215",
3
+ "version": "3.2.217",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -551,6 +551,7 @@ class Server {
551
551
  install_required = true
552
552
  }
553
553
 
554
+
554
555
  res.render("download", {
555
556
  error,
556
557
  current: req.originalUrl,
@@ -12,6 +12,7 @@ const installname = async (url, name) => {
12
12
  focusConfirm: false,
13
13
  // showCancelButton: true,
14
14
  confirmButtonText: 'Download',
15
+ allowOutsideClick: false,
15
16
  didOpen: () => {
16
17
  let input = Swal.getPopup().querySelector('#swal-input1')
17
18
  if (name) {
@@ -59,7 +60,6 @@ const install = async (name, url, term, socket, options) => {
59
60
  } else {
60
61
  cmd = `git clone ${url} ${name}`
61
62
  }
62
- debugger
63
63
  socket.run({
64
64
  method: "shell.run",
65
65
  params: {