-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish-python-package
More file actions
executable file
·46 lines (38 loc) · 991 Bytes
/
publish-python-package
File metadata and controls
executable file
·46 lines (38 loc) · 991 Bytes
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
43
44
45
46
#!/usr/bin/env bash
# call this in the directory of your python project where
# setup.py is.
usage="
NAME
publish-python-package
SYNOPSIS
publish-python-package [-h] [-p|--prod] [-t|--test]
- converts README.md to readme.rst
- creates distrubution files for version specified in setup.py
- publishes dist to either pypi or testpypi
ARGUMENTS
-t|--test
-v|--prod
"
while test $# -gt 0; do
case "$1" in
-h|--help|-\?)
echo "$usage" && exit;;
-t|--test)
upstream='pypitest' && shift;;
-p|--prod)
upstream='pypi' && shift;;
*)
break
esac
shift
done
if [ -z ${upstream+x} ]; then
echo "Error: must set either -p or -t, see -h for details"
exit 1
fi
# remove the existing dist/ so that we don't re-publish
rm -rf dist
# creates the tar in dist/
python setup.py sdist bdist_wheel
# pushes the new package to pypi
twine upload -r $upstream dist/*