Skip to content

Commit 9c50e6d

Browse files
Linux fear
1 parent fc33569 commit 9c50e6d

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

kratos.gid/scripts/Launch.tcl

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ proc Kratos::InstallAllPythonDependencies { } {
1515
}
1616
}
1717

18+
if {$os eq "win"} {set pip "pyw"} {set pip "python3"}
1819
set missing_packages [Kratos::GetMissingPipPackages]
1920
::GidUtils::SetWarnLine "Installing pip packages $missing_packages"
2021
if {[llength $missing_packages] > 0} {
21-
exec pyw -m pip install --no-cache-dir --disable-pip-version-check {*}$missing_packages
22+
exec $pip -m pip install --no-cache-dir --disable-pip-version-check {*}$missing_packages
2223
}
2324
}
2425

26+
proc Kratos::InstallPip { } {
27+
W ""
28+
}
29+
2530
proc Kratos::pythonVersion {{pythonExecutable "python"}} {
2631
# Tricky point: Python 2.7 writes version info to stderr!
2732
set ver 0
@@ -35,9 +40,12 @@ proc Kratos::pythonVersion {{pythonExecutable "python"}} {
3540
}
3641

3742
proc Kratos::pipVersion { } {
43+
44+
if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
45+
if {$os eq "win"} {set pip "pyw"} {set pip "python3"}
3846
set ver 0
3947
catch {
40-
set info [exec pyw -m pip --version 2>@1]
48+
set info [exec $pip -m pip --version 2>@1]
4149
if {[regexp {^pip ([\d.]+)*} $info --> version]} {
4250
set ver $version
4351
}
@@ -51,8 +59,10 @@ proc Kratos::GetMissingPipPackages { } {
5159
KratosDEMApplication numpy KratosDamApplication KratosSwimmingDEMApplication KratosStructuralApplication KratosMeshMovingApplication \
5260
KratosMappingApplication KratosParticleMechanicsApplication KratosLinearSolversApplication KratosContactStructuralMechanicsApplication]
5361

62+
if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
63+
if {$os eq "win"} {set pip "pyw"} {set pip "python3"}
5464
set pip_packages_installed [list ]
55-
set pip_packages_installed_raw [exec pyw -m pip list --format=freeze --disable-pip-version-check 2>@1]
65+
set pip_packages_installed_raw [exec $pip -m pip list --format=freeze --disable-pip-version-check 2>@1]
5666
foreach package $pip_packages_installed_raw {
5767
lappend pip_packages_installed [lindex [split $package "=="] 0]
5868
}
@@ -67,7 +77,9 @@ proc Kratos::CheckDependencies { } {
6777
if { [GidUtils::IsTkDisabled] } {
6878
return 0
6979
}
70-
set py_version [Kratos::pythonVersion]
80+
if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
81+
if {$os eq "win"} {set py "python"} {set py "python3"}
82+
set py_version [Kratos::pythonVersion $py]
7183
if {$py_version <= 0} {
7284
set msgBox_type yesno
7385
# -do_not_ask_again 1 -do_not_ask_again_key "kratos_install_python"
@@ -81,6 +93,12 @@ proc Kratos::CheckDependencies { } {
8193

8294
}
8395
}
96+
set pip_version [Kratos::pipVersion]
97+
if {$pip_version <= 0} {
98+
error "pip is not installed on your system."
99+
}
100+
101+
84102
set missing_packages [Kratos::GetMissingPipPackages]
85103
if {[llength $missing_packages] > 0} {
86104
set msgBox_type yesno

0 commit comments

Comments
 (0)