scripts to publish to pypi

This commit is contained in:
S Groesz 2020-11-19 04:56:22 +00:00
parent 3ad4435b3f
commit 1226400c2d
2 changed files with 64 additions and 0 deletions

2
build.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh -
python3 setup.py sdist bdist_wheel

62
publish.sh Executable file
View File

@ -0,0 +1,62 @@
#!/bin/sh -
_FALSE=0
_TRUE=1
__ScriptName="publish.sh"
username="__token__"
test_token=`cat test.token`
pypi_token=`cat pypi.token`
#-------------------------------------------------------------------------------------------------------
# Handle command line arguments
#-------------------------------------------------------------------------------------------------------
_USERNAME="__token__"
_TOKEN=""
_TESTREPO=$_FALSE
PTYPE="test"
#--- FUNCTION ----------------------------------------------------------------------------------------
# NAME: __usage
# DESCRIPTION: Display usage information.
#-------------------------------------------------------------------------------------------------------
__usage() {
cat << EOT
Usage : ${__ScriptName} [options] <publish-type>
Publish types:
- pypi Publish to pypi
- test Publish to test.pypi.org
EOT
} # ---------- end of function __usage ----------
while getopts ':h' opt
do
case "${opt}" in
h ) __usage; exit 0 ;;
\?) echo "Invalid option : $OPTARG"
__usage
exit 1
;;
esac
done
shift $((OPTIND-1))
# Define publish type
if [ "$#" -gt 0 ]; then
PTYPE=$1
shift
fi
# Check publish type
if [ "$(echo "$PTYPE" | grep -E '(pypi|test)')" = "" ]; then
echo "Publish type \"$PTYPE\" is invalid..."
exit 1
fi
# command: python3 -m twine upload --username $_USERNAME --password $_TOKEN --non-interactive --repository $_REPO dist/*
python3 -m twine upload --username $_USERNAME --password $_TOKEN --non-interactive --repository $_REPO dist/*