Skip to content

Commit

Permalink
Merge pull request #26 from aayushi-droid/dev
Browse files Browse the repository at this point in the history
Created update_package.sh files
  • Loading branch information
codeperfectplus authored Oct 17, 2022
2 parents cf2cc65 + bd79ad7 commit 16dddc1
Showing 1 changed file with 53 additions and 0 deletions.
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 {} \;

0 comments on commit 16dddc1

Please sign in to comment.