@@ -22,6 +22,48 @@ Checking python availability:"
22
22
echo
23
23
}
24
24
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
+
25
67
function pipx_error(){
26
68
cat << END
27
69
The installation has failed!!!
@@ -76,18 +118,21 @@ function uninstall(){
76
118
echo ' Uninstalling PyRadio'
77
119
echo -n ' ** Removing python files ... '
78
120
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
84
129
if [ -z " ${PIPX} " ]
85
130
then
86
131
python -m pip uninstall -y pyradio 2> /dev/null 1>&2
87
132
python2 -m pip uninstall -y pyradio 2> /dev/null 1>&2
88
133
python3 -m pip uninstall -y pyradio 2> /dev/null 1>&2
89
134
else
90
- python " ${TO_PYTHON} " -m pipx uninstall pyradio 2> /dev/null 1>&2
135
+ $PIPX_CMD uninstall pyradio 2> /dev/null 1>&2
91
136
fi
92
137
echo ' done'
93
138
echo -n ' ** Removing help files ... '
345
390
done
346
391
set -- " ${POSITIONAL[@]} " # restore positional parameters
347
392
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
-
367
393
# check dependencies :)
368
- # for prog in git sed ;do
369
394
for prog in sed ; do
370
395
${prog} --version 2> /dev/null 1>&2 || {
371
396
if [ " ${prog} " = " sed" ]
@@ -383,24 +408,19 @@ for prog in sed ;do
383
408
}
384
409
done
385
410
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..."
394
411
do_dev
395
412
396
413
#
397
414
# Use pipx by default, if installed
398
415
echo -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
404
424
405
425
if [ $( uname -s) = " Darwin" ] || [ $( uname -s) = " darwin" ]
406
426
then
@@ -468,12 +488,12 @@ else
468
488
fi
469
489
if [ -z " $PIPX_ISOLATE " ]
470
490
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
472
492
inst_type=1
473
493
else
474
- python3 -m pipx install $PIPX_EDITABLE --force . || pipx_error
494
+ $PIPX_CMD install $PIPX_EDITABLE --force . || pipx_error
475
495
[ -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
477
497
inst_type=2
478
498
fi
479
499
fi
0 commit comments