forked from tliron/puccini
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-wrapper-python
executable file
·82 lines (55 loc) · 1.8 KB
/
build-wrapper-python
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
77
78
79
80
81
82
#!/bin/bash
set -e
# Requirements (Fedora)
# sudo dnf install python3-virtualenv
HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")")
. "$HERE/_env"
DIST=$ROOT/dist/python
VENV=$ROOT/dist/python-env
PYTHON_VERSION=cp39 # CPython 3.9
PLATFORM=manylinux1_x86_64 # default is linux_x86_64, which is not widely used
git_version
VERSION=${SHORT_VERSION:1}$SUFFIX
rm --force --recursive "$DIST"
mkdir --parents "$DIST"
cd "$DIST"
rsync --recursive "$ROOT/wrappers/python"/* .
rsync "$ROOT/go.mod" "$ROOT/go.sum" puccini/go-source/
echo 'go 1.18
use .' > puccini/go-source/go.work
rsync --recursive "$ROOT/tosca" puccini/go-source/
rsync --recursive "$ROOT/clout" puccini/go-source/
rsync --recursive "$ROOT/puccini-tosca" puccini/go-source/
echo "__version__ = '$VERSION'" > puccini/__init__.py
rm --recursive --force "$VENV"
# Must use "--system-site-packages" so that Ansible can access localhost on SELinux
python3 -m venv --system-site-packages --upgrade-deps "$VENV"
. "$VENV/bin/activate"
python -m pip install wheel
if [ "$1" == -e ]; then
# Install editable
python -m pip install --editable .
else
# Build
./setup.py sdist bdist_wheel --plat-name=$PLATFORM
SDIST=dist/puccini-$VERSION.tar.gz
BDIST=dist/puccini-$VERSION-$PYTHON_VERSION-$PYTHON_VERSION-$PLATFORM.whl
if [ "$1" == -s ]; then
# Install sdist
python -m pip install "$SDIST"
elif [ "$1" == -b ]; then
# Install bdist
python -m pip install "$BDIST"
elif [ "$1" == -p ]; then
# Publish
python -m pip install twine
gpg --detach-sign --armor --yes "$SDIST"
gpg --detach-sign --armor --yes "$BDIST"
# Upload to PyPI
twine upload \
"$SDIST" \
"$SDIST.asc" \
"$BDIST" \
"$BDIST.asc"
fi
fi