Skip to content

Commit ffb31d5

Browse files
Merge branch 'main' into dev
2 parents afffedd + 6b24c18 commit ffb31d5

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

scripts/update_package.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# Update package on pypi server
4+
5+
# check for flake8 and twine and install if not present
6+
if ! [ -x "$(command -v flake8)" ]; then
7+
echo 'Error: flake8 is not installed.' >&2
8+
echo 'Installing flake8...'
9+
pip install flake8
10+
fi
11+
12+
if ! [ -x "$(command -v twine)" ]; then
13+
echo 'Error: twine is not installed.' >&2
14+
echo 'Installing twine...'
15+
pip install twine
16+
fi
17+
18+
# check for setup.py
19+
if ! [ -f "setup.py" ]; then
20+
echo 'Error: setup.py is not found.' >&2
21+
exit 1
22+
fi
23+
24+
25+
# run sdists and wheels
26+
python3 setup.py sdist bdist_wheel
27+
28+
# check for dist folder
29+
if ! [ -d "dist" ]; then
30+
echo 'Error: dist folder is not found.' >&2
31+
exit 1
32+
fi
33+
34+
35+
read -p "Do you want to upload to pypi? (y/n) " -n 1 -r
36+
echo
37+
if [[ $REPLY =~ ^[Yy]$ ]]
38+
then
39+
python3 -m twine upload dist/*
40+
fi
41+
42+
43+
# remove dist folder
44+
rm -rf dist
45+
46+
# remove build folder
47+
rm -rf build
48+
49+
# remove .egg-info folder
50+
rm -rf *.egg-info
51+
52+
# remove .pyc files
53+
find . -name "*.pyc" -exec rm -rf {} \;

0 commit comments

Comments
 (0)