Skip to content

Commit

Permalink
Update packager
Browse files Browse the repository at this point in the history
  • Loading branch information
mbourqui committed May 3, 2018
1 parent 5e61f29 commit a840afe
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions pypi_packager.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# This script generates a package and submits it to the Python Package Index
# Copyright (C) 2017 Marc Bourqui
# Copyright (C) 2017-2018 Marc Bourqui
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -21,20 +21,23 @@
#author :https://github.com/mbourqui
#licence :GNU GPL-3.0
#date :20170526
#version :1.1
#version :1.2.1
#usage :bash pypi_packager.sh
#requires :pandoc
#notes :In case of submission to PyPI, ~/.pypirc must be set
# accordingly
#==============================================================================

PROGRAM_NAME=$(basename "$0")
VERSION=1.1
VERSION=1.2.1
PROJECT_NAME=$(basename $(pwd))
PACKAGE_NAME=${PROJECT_NAME//-/_} # Replace all - with _

copyright() {
echo "$PROGRAM_NAME Copyright (C) 2017-2018 Marc Bourqui"
}

usage() {
echo "$PROGRAM_NAME Copyright (C) 2017 Marc Bourqui
copyright
echo "
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain
conditions, see <http://www.gnu.org/licenses/> for details.
Expand All @@ -45,9 +48,8 @@ converts a README.md to README.rst thanks to pandoc for nice rendering on PyPI.
Usage: $PROGRAM_NAME [-h,--help,-v,--version] [-s,--submit|-t,--test]
Options:
-s, --submit upload the package to PyPI. Requires ~/.pypirc to be set.
-t, --test upload the package to TestPyPI. Requires ~/.pypirc to be
set.
-s, --submit upload the package to PyPI.
-t, --test upload the package to TestPyPI.
-h, --help display this help and exit
-v, --version output version information and exit"
Expand Down Expand Up @@ -94,6 +96,9 @@ if [ -n "$SUBMIT" -a -n "$TEST" ]; then
exit 1
fi

copyright
echo "Thank you for using this utility"

# Clear previous compilations to prevent potential issues and limit disk space
# usage
rm -f README.rst
Expand All @@ -114,7 +119,6 @@ if [ -n "$SUBMIT" ]; then
twine upload dist/*
elif [ -n "$TEST" ]; then
# Upload to TestPyPI
python setup.py register -r https://testpypi.python.org/pypi
twine upload dist/* -r testpypi
pip install -i https://testpypi.python.org/pypi $PACKAGE_NAME
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
pip install --index-url https://test.pypi.org/legacy/ $PACKAGE_NAME
fi

0 comments on commit a840afe

Please sign in to comment.