@@ -173,6 +173,37 @@ function isDarkMode () {
173173 fi
174174}
175175
176+ function errorNoPython () {
177+ writeLine
178+ writeLine
179+ writeLine " ----------------------------------------------------------------------" $color_primary
180+ writeLine " Error: Python not installed" $color_error
181+ writeLine
182+ writeLine
183+
184+ quit
185+ }
186+
187+ function spin () {
188+
189+ local pid=$1
190+
191+ spin[0]=' -'
192+ spin[1]=' \\'
193+ spin[2]=' |'
194+ spin[3]=' /'
195+
196+ while kill -0 $pid 2> /dev/null; do
197+ for i in " ${spin[@]} "
198+ do
199+ echo -ne " $i \b"
200+ sleep 0.1
201+ done
202+ done
203+
204+ echo -ne ' \b'
205+ }
206+
176207# Outputs a line, including linefeed, to the terminal using the given foreground
177208# / background colors
178209#
@@ -552,28 +583,28 @@ function installPythonPackages () {
552583
553584 requirementsFilename=" "
554585
555- if /i " !enableGPU!" == " true" (
586+ if [ " !enableGPU!" == " true" ] ; then
556587 if [ " $hasCUDA " == " true" ]; then
557- if [ ! -f " ${requirementsDir} /requirements.${platform} .cuda.txt" ]; then
588+ if [ -f " ${requirementsDir} /requirements.${platform} .cuda.txt" ]; then
558589 requirementsFilename=" requirements.${platform} .cuda.txt"
559- elif [ ! -f " ${requirementsDir} /requirements.cuda.txt" ]; then
590+ elif [ -f " ${requirementsDir} /requirements.cuda.txt" ]; then
560591 requirementsFilename=" requirements.cuda.txt"
561592 fi
562593 fi
563594
564595 if [ " $requirementsFilename " == " " ]; then
565- if [ ! -f " ${requirementsDir} /requirements.${platform} .gpu.txt" ]; then
596+ if [ -f " ${requirementsDir} /requirements.${platform} .gpu.txt" ]; then
566597 requirementsFilename=" requirements.${platform} .gpu.txt"
567- elif [ ! -f " ${requirementsDir} /requirements.gpu.txt" ]; then
598+ elif [ -f " ${requirementsDir} /requirements.gpu.txt" ]; then
568599 requirementsFilename=" requirements.gpu.txt"
569600 fi
570601 fi
571602 fi
572603
573604 if [ " $requirementsFilename " == " " ]; then
574- if [ ! -f " ${requirementsDir} /requirements.${platform} .txt" ]; then
605+ if [ -f " ${requirementsDir} /requirements.${platform} .txt" ]; then
575606 requirementsFilename=" requirements.${platform} .txt"
576- elif [ ! -f " ${requirementsDir} /requirements.txt" ]; then
607+ elif [ -f " ${requirementsDir} /requirements.txt" ]; then
577608 requirementsFilename=" requirements.txt"
578609 fi
579610 fi
@@ -582,10 +613,15 @@ function installPythonPackages () {
582613 requirementsPath=" ${requirementsDir} /${requirementsFilename} "
583614 fi
584615
585- if [ " $requirementsFilename " == " " ] || [ ! -f " $requirementsPath " ] ; then
616+ if [ " $requirementsFilename " == " " ]; then
586617 writeLine " No suitable requirements.txt file found." $color_warn
587618 return
588- )
619+ fi
620+
621+ if [ ! -f " $requirementsPath " ]; then
622+ writeLine " Can't find ${requirementsPath} file." $color_warn
623+ return
624+ fi
589625
590626 virtualEnv=" ${analysisLayerPath} /bin/${platform} /${pythonName} /venv"
591627
@@ -731,37 +767,6 @@ function installPythonPackages () {
731767 fi
732768}
733769
734- function errorNoPython () {
735- writeLine
736- writeLine
737- writeLine " ----------------------------------------------------------------------" $color_primary
738- writeLine " Error: Python not installed" $color_error
739- writeLine
740- writeLine
741-
742- quit
743- }
744-
745- function spin () {
746-
747- local pid=$1
748-
749- spin[0]=' -'
750- spin[1]=' \\'
751- spin[2]=' |'
752- spin[3]=' /'
753-
754- while kill -0 $pid 2> /dev/null; do
755- for i in " ${spin[@]} "
756- do
757- echo -ne " $i \b"
758- sleep 0.1
759- done
760- done
761-
762- echo -ne ' \b'
763- }
764-
765770function getFromServer () {
766771
767772 # eg packages_for_gpu.zip
@@ -793,7 +798,7 @@ function getFromServer () {
793798
794799 pushd " ${downloadPath} /${moduleDir} /" > /dev/null 2> /dev/null
795800 mv * " ${modulePath} /${moduleAssetsDir} /"
796- popd
801+ popd > /dev/null 2> /dev/null
797802 fi
798803 fi
799804}
0 commit comments