-
Notifications
You must be signed in to change notification settings - Fork 415
/
py_installer.sh
executable file
·54 lines (45 loc) · 1.25 KB
/
py_installer.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# make sure your python path is like the below ones.
# python: /home/ubuntu/anaconda3/bin/python
# working in the directory with `setup.py` file.
# get the latest jionlp version
current_dir_path=$(pwd)
echo "Current directory: $current_dir_path"
jionlp_version=`cat ${current_dir_path}/jionlp/__init__.py | grep -iPo "(?<=(__version__ = \'))([0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2})"`
echo "jionlp version: ${jionlp_version}"
# clean redundant dirs
if [ -d build ]; then
rm -rf build
fi
if [ -d jionlp.egg-info ]; then
rm -rf jionlp.egg-info
fi
to_be_deleted=(
char_distribution.json
china_location.txt
chinese_char_dictionary.txt
chinese_idiom.txt
chinese_word_dictionary.txt
idf.txt
phone_location.txt
pinyin_phrase.txt
pornography.txt
sentiment_words.txt
topic_word_weight.json
word_distribution.json
word_topic_weight.json
xiehouyu.txt)
for item in ${to_be_deleted[*]};
do
if [ -f ./jionlp/dictionary/$item ]; then
echo "deleting redundant file: " $item
rm -rf ./jionlp/dictionary/$item
fi
done
# char_distribution.json
python3 setup.py bdist_wheel --universal
ls -lth ./dist/ | grep ${jionlp_version}
pip install twine
twine upload ./dist/jionlp-${jionlp_version}-py2.py3-none-any.whl
echo "finished!"
exit 0