-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathinstall_local.sh
More file actions
executable file
·42 lines (31 loc) · 1.08 KB
/
install_local.sh
File metadata and controls
executable file
·42 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! /bin/bash
get_value_from_file() {
key=$1
file=$2
val=( $(cat $file | grep -Eo "${key}=.{1,50}" | sed "s/^${key}=\"\(.*\)\",$/\1/") )
echo $val
}
GREEN='\033[0;32m'
NC='\033[0m' # No Color
YELLOW='\033[0;33m'
RED='\033[0;31m'
lib_version=( $(get_value_from_file 'version' setup.py) )
lib_name=( $(get_value_from_file 'name' setup.py) )
python3 setup.py sdist bdist_wheel
pip uninstall --y $lib_name
if pip install ./dist/${lib_name}-${lib_version}.tar.gz ; then
rm -rf ./build
rm -rf ./dist
rm -rf ./*.egg-info
echo
echo -e "${GREEN}##########################################################${NC}"
echo -e "${GREEN} Successfully Installed: ${YELLOW}${lib_name}-${lib_version}${NC}"
echo -e "${GREEN}##########################################################${NC}"
echo
else
echo
echo -e "${RED}##########################################################${NC}"
echo -e "${RED} Failed to Install: ${YELLOW}${lib_name}-${lib_version}${NC}"
echo -e "${RED}##########################################################${NC}"
echo
fi