@@ -22,6 +22,48 @@ Checking python availability:"
2222 echo
2323}
2424
25+ function check_pipx() {
26+ # Δοκιμή 1: python -m pipx
27+ local pipx_test=$( python" ${TO_PYTHON} " -m pipx --version 2> /dev/null)
28+ if [ -n " $pipx_test " ]; then
29+ echo " python${TO_PYTHON} -m pipx"
30+ return 0
31+ fi
32+
33+ # Δοκιμή 2: standalone pipx
34+ pipx_test=$( pipx --version 2> /dev/null)
35+ if [ -n " $pipx_test " ]; then
36+ echo " pipx"
37+ return 0
38+ fi
39+
40+ # Δοκιμή 3: απόλυτο path (συνήθης θέση σε macOS)
41+ pipx_test=$( /usr/local/bin/pipx --version 2> /dev/null)
42+ if [ -n " $pipx_test " ]; then
43+ echo " /usr/local/bin/pipx"
44+ return 0
45+ fi
46+
47+ # Δοκιμή 4: άλλα πιθανά paths
48+ local potential_paths=(
49+ " /opt/homebrew/bin/pipx"
50+ " /usr/bin/pipx"
51+ " $HOME /.local/bin/pipx"
52+ )
53+
54+ for path in " ${potential_paths[@]} " ; do
55+ if [ -x " $path " ]; then
56+ pipx_test=$( " $path " --version 2> /dev/null)
57+ if [ -n " $pipx_test " ]; then
58+ echo " $path "
59+ return 0
60+ fi
61+ fi
62+ done
63+
64+ return 1
65+ }
66+
2567function pipx_error(){
2668cat << END
2769The installation has failed!!!
@@ -76,18 +118,21 @@ function uninstall(){
76118 echo ' Uninstalling PyRadio'
77119 echo -n ' ** Removing python files ... '
78120 echo -n " Looking for pipx ... "
79- PIPX_VERSION=$( python" ${TO_PYTHON} " -m pipx --version)
80- [ -z " $PIPX_VERSION " ] || PIPX=1
81- [ -z " $PIPX_VERSION " ] && {
82- echo " Command used: python" ${TO_PYTHON} " -m pipx --version 2>/dev/null"
83- } || echo " $PIPX_VERSION "
121+ PIPX_CMD=$( check_pipx)
122+ if [ -n " $PIPX_CMD " ]; then
123+ PIPX=1
124+ PIPX_VERSION=$( $PIPX_CMD --version 2> /dev/null)
125+ echo " $PIPX_VERSION (found via: $PIPX_CMD )"
126+ else
127+ echo " not found"
128+ fi
84129 if [ -z " ${PIPX} " ]
85130 then
86131 python -m pip uninstall -y pyradio 2> /dev/null 1>&2
87132 python2 -m pip uninstall -y pyradio 2> /dev/null 1>&2
88133 python3 -m pip uninstall -y pyradio 2> /dev/null 1>&2
89134 else
90- python " ${TO_PYTHON} " -m pipx uninstall pyradio 2> /dev/null 1>&2
135+ $PIPX_CMD uninstall pyradio 2> /dev/null 1>&2
91136 fi
92137 echo ' done'
93138 echo -n ' ** Removing help files ... '
345390done
346391set -- " ${POSITIONAL[@]} " # restore positional parameters
347392
348- # if [ -z "$NO_DEV" ]
349- # then
350- # cd pyradio
351- # DEVEL=$(python -c 'from install import get_github_long_description_for_script; get_github_long_description_for_script()')
352- # # DEVEL=$(python -c 'from install import get_devel_version; print(get_devel_version())')
353- # echo "Devel version: $DEVEL"
354- # cd ..
355- # fi
356-
357-
358- # # check dependencies :)
359- # for prog in git sed ;do
360- # ${prog} --version 2>/dev/null 1>&2 || {
361- # echo "Error: ${prog} not found."
362- # echo " Please install it and try again."
363- # exit 1
364- # }
365- # done
366-
367393# check dependencies :)
368- # for prog in git sed ;do
369394for prog in sed ; do
370395 ${prog} --version 2> /dev/null 1>&2 || {
371396 if [ " ${prog} " = " sed" ]
@@ -383,24 +408,19 @@ for prog in sed ;do
383408 }
384409done
385410
386- # uninstall previous versions
387- # uninstall 1
388-
389- # # delete any files that were left from previous attempt
390- # sudo find . -iname "*.pyc" -delete 2>/dev/null
391- # sudo find . -iname "*.egg" -delete 2>/dev/null
392-
393- # echo "***** installing for user..."
394411do_dev
395412
396413#
397414# Use pipx by default, if installed
398415echo -n " Looking for pipx ... "
399- PIPX_VERSION=$( python" ${TO_PYTHON} " -m pipx --version)
400- [ -z " $PIPX_VERSION " ] || PIPX=1
401- [ -z " $PIPX_VERSION " ] && {
402- echo " Command used: python" ${TO_PYTHON} " -m pipx --version 2>/dev/null"
403- } || echo " $PIPX_VERSION "
416+ PIPX_CMD=$( check_pipx)
417+ if [ -n " $PIPX_CMD " ]; then
418+ PIPX=1
419+ PIPX_VERSION=$( $PIPX_CMD --version 2> /dev/null)
420+ echo " $PIPX_VERSION (found via: $PIPX_CMD )"
421+ else
422+ echo " not found"
423+ fi
404424
405425if [ $( uname -s) = " Darwin" ] || [ $( uname -s) = " darwin" ]
406426then
@@ -468,12 +488,12 @@ else
468488 fi
469489 if [ -z " $PIPX_ISOLATE " ]
470490 then
471- python3 -m pipx install $PIPX_EDITABLE --system-site-packages --force . || pipx_error
491+ $PIPX_CMD install $PIPX_EDITABLE --system-site-packages --force . || pipx_error
472492 inst_type=1
473493 else
474- python3 -m pipx install $PIPX_EDITABLE --force . || pipx_error
494+ $PIPX_CMD install $PIPX_EDITABLE --force . || pipx_error
475495 [ -z " $PIPX_EDITABLE " ] && \
476- cat requirements_pipx.txt | sed -e ' s/#.*//' | xargs python3 -m pipx inject pyradio
496+ cat requirements_pipx.txt | sed -e ' s/#.*//' | xargs $PIPX_CMD inject pyradio
477497 inst_type=2
478498 fi
479499fi
0 commit comments