Skip to content

Commit 26d6185

Browse files
Place python path default
1 parent ccf73e2 commit 26d6185

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

kratos.gid/scripts/Controllers/PreferencesWindow.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ proc Kratos::ManagePreferences { cmd name {value ""}} {
3939
set ret "fjgarate/kratos-run"
4040
}
4141
"python_path" {
42-
set ret [Kratos::GetDefaultPythonPath]
42+
set ret [file join [Kratos::GetDefaultPythonPath] [Kratos::GetPythonExeName] ]
4343
}
4444
default {
4545
set ret 0

kratos.gid/scripts/Launch.tcl

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ proc Kratos::InstallAllPythonDependencies { } {
44

55
if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
66
set dir [lindex [Kratos::GetLaunchConfigurationFile] 0]
7-
if {$os eq "win"} {set py "python"} {set py "python3"}
7+
set py [Kratos::GetPythonExeName]
88
# Check if python is installed. minimum 3.5, best 3.9
99
set python_version [pythonVersion $py]
1010
if { $python_version <= 0 || [GidUtils::TwoVersionsCmp $python_version "3.9.0"] <0 } {
@@ -35,6 +35,18 @@ proc Kratos::InstallPip { } {
3535
W ""
3636
}
3737

38+
proc Kratos::GetPythonExeName { } {
39+
40+
if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
41+
if {$os eq "win"} {set py "python"} {set py "python3"}
42+
return $py
43+
}
44+
45+
proc Kratos::GetDefaultPythonPath { } {
46+
set py [Kratos::GetPythonExeName]
47+
return [exec $py -c "import sys; print(sys.exec_prefix)" 2>@1]
48+
}
49+
3850
proc Kratos::pythonVersion {{pythonExecutable "python"}} {
3951
# Tricky point: Python 2.7 writes version info to stderr!
4052
set ver 0
@@ -65,11 +77,9 @@ proc Kratos::GetMissingPipPackages { } {
6577
variable pip_packages_required
6678
set missing_packages [list ]
6779

68-
69-
if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
70-
if {$os eq "win"} {set pip "pyw"} {set pip "python3"}
80+
set py [Kratos::GetPythonExeName]
7181
set pip_packages_installed [list ]
72-
set pip_packages_installed_raw [exec $pip -m pip list --format=freeze --disable-pip-version-check 2>@1]
82+
set pip_packages_installed_raw [exec $py -m pip list --format=freeze --disable-pip-version-check 2>@1]
7383
foreach package $pip_packages_installed_raw {
7484
lappend pip_packages_installed [lindex [split $package "=="] 0]
7585
}
@@ -94,8 +104,7 @@ proc Kratos::CheckDependenciesPipMode {} {
94104
if { [GidUtils::IsTkDisabled] } {
95105
return 0
96106
}
97-
if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
98-
if {$os eq "win"} {set py "python"} {set py "python3"}
107+
set py [Kratos::GetPythonExeName]
99108
set py_version [Kratos::pythonVersion $py]
100109
if {$py_version <= 0} {
101110
set msgBox_type yesno

0 commit comments

Comments
 (0)