-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
# Update package on pypi server | ||
|
||
# check for flake8 and twine and install if not present | ||
if ! [ -x "$(command -v flake8)" ]; then | ||
echo 'Error: flake8 is not installed.' >&2 | ||
echo 'Installing flake8...' | ||
pip install flake8 | ||
fi | ||
|
||
if ! [ -x "$(command -v twine)" ]; then | ||
echo 'Error: twine is not installed.' >&2 | ||
echo 'Installing twine...' | ||
pip install twine | ||
fi | ||
|
||
# check for setup.py | ||
if ! [ -f "setup.py" ]; then | ||
echo 'Error: setup.py is not found.' >&2 | ||
exit 1 | ||
fi | ||
|
||
|
||
# run sdists and wheels | ||
python3 setup.py sdist bdist_wheel | ||
|
||
# check for dist folder | ||
if ! [ -d "dist" ]; then | ||
echo 'Error: dist folder is not found.' >&2 | ||
exit 1 | ||
fi | ||
|
||
|
||
read -p "Do you want to upload to pypi? (y/n) " -n 1 -r | ||
echo | ||
if [[ $REPLY =~ ^[Yy]$ ]] | ||
then | ||
python3 -m twine upload dist/* | ||
fi | ||
|
||
|
||
# remove dist folder | ||
rm -rf dist | ||
|
||
# remove build folder | ||
rm -rf build | ||
|
||
# remove .egg-info folder | ||
rm -rf *.egg-info | ||
|
||
# remove .pyc files | ||
find . -name "*.pyc" -exec rm -rf {} \; |