-
Notifications
You must be signed in to change notification settings - Fork 8
/
upload_to_pypi
executable file
·42 lines (33 loc) · 820 Bytes
/
upload_to_pypi
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
38
39
40
41
42
#!/bin/bash
# --------------------------------------------------------------------
# Run this within a local respository directory to upload the latest
# release to PyPi
#
# It is presumed that `python setup.py sdist` has already been run.
#
# >> ./upload_to_pypi 2.0.4
#
# Upload to https://test.pypi.org
#
# >> ./upload_to_pypi 2.0.4 test
#
# --------------------------------------------------------------------
set -x
if [[ ! $1 ]] ; then
echo "No version \$1 (e.g. 2.0.1)"
exit 1
fi
if [[ $2 == "test" ]] ; then
echo "Uploading to testpypi"
repository="--repository testpypi"
else
repository=""
fi
version=$1
tarball=dist/cfunits-${version}.tar.gz
if [[ ! -f $tarball ]] ; then
echo "Tar ball for version $version does not exist: $tarball"
exit 2
fi
twine upload $repository $tarball
set +x