-
Notifications
You must be signed in to change notification settings - Fork 0
/
package
60 lines (54 loc) · 1.96 KB
/
package
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
package()
{
set +e
packaging="$1/dune-common/bin/dunepackaging.py"
if [ ! -f $packaging ]; then
packaging="dunepackaging.py"
fi
# check if the commit is tagged. If tagged use the tag as
# version number (assumes the tag is a valid python package version, i.e., v2.8.0rc1
# otherwise use the default 'dev' numbering.
# Note: the current commit could have multiple tags - make sure to use the latest
tag=$(git tag --contains | sort | tail -1)
ver=${tag/v/} # remove the 'v' from the tag to get the version
python $GITHUB_WORKSPACE/testpyversion.py $ver
badVersion=$?
if [ "$ver" = "" ] || [ $badVersion -ne 0 ]; then
echo "Use dev versioning - $tag did not provide a version ($ver)"
$packaging --onlysdist
else
echo "Use version" $ver
$packaging --onlysdist --version=$ver
fi
}
clonemodule()
{
set +e
m=$1 # module name
p=$2 # path to module
v=$3 # version tag to check if available on pypi
t=$4 # tag/branch to try to clone into - master used if not available
echo "cloning called for module:$m path:$p version:$v tag:$t into $PWD"
# test if package with this version is already uploaded to pypi
# if it is no new package will be build and the pypi package is used
if ! python3 ../testpypi.py $m $v ; then
echo "Try cloning from $p branch $t"
git clone --depth 1 -b $t $p # > /dev/null 2>&1
if [ ! $? = 0 ]; then # the branch/tag didn't exist so use master - if no upload is to be done
if [ ! "$upload" = "none" ] && [ ! "$upload" = "" ]; then
echo "required branch $t not found in $m - this inconsistent state should not be uploaded."
echo "Rerun test with 'upload=none'."
exit 1
fi
echo "using master since $t branch not found!"
git clone --depth 1 $p # > /dev/null 2>&1
fi
cd $m
git log | head
package $base
cd ..
else
echo "module with this version found on $upload - using that instead of cloning"
fi
set -e
}