forked from MetPX/sarracenia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish-to-pypi.sh
executable file
·76 lines (65 loc) · 1.94 KB
/
publish-to-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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# This file is part of sarracenia.
# The sarracenia suite is Free and is proudly provided by the Government of Canada
# Copyright (C) Her Majesty The Queen in Right of Canada, Environment Canada, 2008-2015
#
# Questions or bugs report: [email protected]
# sarracenia repository: git://git.code.sf.net/p/metpx/git
# Documentation: http://metpx.sourceforge.net/#SarraDocumentation
#
# publish-to-pypi.sh : publish sarracenia to PyPi
#
#
# Code contributed by:
# Khosrow Ebrahimpour - Shared Services Canada
#
########################################################################
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Assumptions:
# 1. release.sh has been run and a new release made
# 2. PyPi configuration is in place
#
# Steps:
# 1. build the wheel
# 2. upload the wheel to PyPi
usage() {
echo "`basename $0` <git tag>"
exit 2
}
if [ $# -ne 1 ]; then
usage
exit 2
fi
# checkout the tag version
git checkout $1
# Copy the code to a tempdir to build
TMPDIR=`mktemp --tmpdir=/tmp -d metpx-build.XXXX`
P=$PWD
cp -ap . $TMPDIR
cd $TMPDIR
python3 setup.py bdist_wheel
if [ $? -ne 0 ]; then
echo "Please fix errors and retry uploading to PyPi!"
cd $P
git checkout master
exit 1
fi
python3 setup.py bdist_wheel upload
# clean up
cd $P
git checkout master
rm -rf $TMPDIR