Skip to content

Commit 989180c

Browse files
committed
visualpython#37 - visualpy batch & shell add checking pip and pip3
1 parent 015c553 commit 989180c

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

bin/visualpy

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@
44
# Filename : visualpy
55
# function : control visualpython for Mac/Linux
66
# Creator : BlackLogic - LJ
7-
# version : 2.1
7+
# version : 2.2
88
# License :
99
# Date : 2020 07.27
10-
# Mdate : 2020 12.29
10+
# Mdate : 2021 06.04
1111
#============================================================================
1212

13-
v_path1=`pip show visualpython | grep Location | awk -F': ' '{print $2}'`
13+
v_pip=pip
14+
which pip3 > /dev/null 2>&1 && v_pip=pip3
15+
16+
v_path1=`${v_pip} show visualpython | grep Location | awk -F': ' '{print $2}'`
1417
v_prod='visualpython'
1518
v_str1='jupyter nbextension'
1619
v_str2='visualpython/src/main'
17-
v_unst='pip uninstall '${v_prod}
18-
v_upgr='pip install '${v_prod}' --upgrade'
19-
#v_srch='pip search '${v_prod}
20-
v_str3='pip list -o '
21-
v_str4='pip show '${v_prod}
20+
v_unst='${v_pip} uninstall '${v_prod}
21+
v_upgr='${v_pip} install '${v_prod}' --upgrade'
22+
#v_srch='${v_pip} search '${v_prod}
23+
v_str3='${v_pip} list -o '
24+
v_str4='${v_pip} show '${v_prod}
2225
#v_list=`${v_str3} | grep -i ${v_prod}`
2326
v_curt=`${v_str4} | grep 'Version' | cut -d ' ' -f 2`
2427
v_option=$1
@@ -294,7 +297,7 @@ f_prt_extensiondir() {
294297
echo "jupyter contrib nbextension install --user"
295298
f_prt_line2
296299
echo "for pip"
297-
echo "pip install -e jupyter_contrib_nbextensions"
300+
echo "${v_pip} install -e jupyter_contrib_nbextensions"
298301
echo "jupyter contrib nbextension install --user"
299302
f_prt_line1
300303
}

bin/visualpy.bat

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,31 @@ rem #==========================================================================
44
rem # Filename : visualpy.bat
55
rem # function : control Visual Python for windows
66
rem # Creator : BlackLogic - LJ
7-
rem # version : 2.1
7+
rem # version : 2.2
88
rem # License : GPLv3
99
rem # Date : 2020 07.30
10-
rem # MDate : 2020 12.29
10+
rem # MDate : 2021 06.04
1111
rem #==========================================================================
1212

1313
rem ## setting variables
1414

15+
set v_pip=pip
16+
where pip3 > /dev/null 2>&1 && set v_pip=pip3
17+
1518
set v_prod=visualpython
1619
(echo "%v_prod%" & echo.) | findstr /O . | more +1 | (set /P RESULT= & call exit /B %%RESULT%%)
1720
set /A v_prd_length=%ERRORLEVEL%-5
1821
set v_option=%1
19-
for /f "delims=, tokens=1*" %%i in ('pip show %v_prod% 2^>^&1 ^| find "Location"') do (
22+
for /f "delims=, tokens=1*" %%i in ('%v_pip% show %v_prod% 2^>^&1 ^| find "Location"') do (
2023
set v_1=%%i)
2124
set v_path1=%v_1:~10%
2225
set v_str1=jupyter nbextension
2326
set v_str2=%v_prod%/src/main
24-
set v_srch=pip search %v_prod%
25-
set v_upgr=pip install %v_prod% --upgrade
26-
set v_unst=pip uninstall %v_prod%
27-
set v_ckup=pip list -o
28-
set v_show=pip show %v_prod%
27+
set v_srch=%v_pip% search %v_prod%
28+
set v_upgr=%v_pip% install %v_prod% --upgrade
29+
set v_unst=%v_pip% uninstall %v_prod%
30+
set v_ckup=%v_pip% list -o
31+
set v_show=%v_pip% show %v_prod%
2932

3033
rem check env & setting path2
3134
where /q conda-env

0 commit comments

Comments
 (0)