Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created update_package.sh files #26

Merged
merged 1 commit into from
Oct 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions update_package.sh
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 {} \;