forked from openpreserve/jpylyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage-pypi.sh
executable file
·37 lines (30 loc) · 994 Bytes
/
package-pypi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# This script creates a wheel distribution and uploads it to PyPi
#
# Requirements:
#
# twine https://pypi.python.org/pypi/twine/1.9.1 (pip install twine)
# wheel https://pypi.python.org/pypi/wheel (pip install wheel)
SCRIPT_DIR="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )")"
cd ${SCRIPT_DIR} || exit
pip install -U twine
# Repository: this is usually pypi; for testing use testpypi
# The corresponding repository URLS are defined in config file ~/.pypirc
# repository=test-jpylyzer
repository=pypi
# Working directory
workDir=$PWD
# Dist directory
distDir=$workDir"/dist/"
# Clear contents of dist dir if it exists
if [ -d "$distDir" ]; then
rm -r "$distDir"
fi
# Create wheel
python setup.py sdist bdist_wheel --universal
# Upload package if wheel build was successful; if not show error message
if [ $? -eq 0 ]; then
twine upload --repository $repository --config-file "/pypirc/.pypirc" dist/*
else
echo "Wheel build not successful quitting now ..."
fi