forked from pulp/pulp_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_python_client.sh
More file actions
executable file
·53 lines (43 loc) · 1.85 KB
/
install_python_client.sh
File metadata and controls
executable file
·53 lines (43 loc) · 1.85 KB
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
#!/bin/bash
# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by it. Please use
# './plugin-template --github pulp_python' to update this file.
#
# For more info visit https://github.com/pulp/plugin_template
set -mveuo pipefail
export PULP_URL="${PULP_URL:-https://pulp}"
# make sure this script runs at the repo root
cd "$(dirname "$(realpath -e "$0")")"/../../..
pip install twine wheel
export REPORTED_VERSION=$(http $PULP_URL/pulp/api/v3/status/ | jq --arg plugin python --arg legacy_plugin pulp_python -r '.versions[] | select(.component == $plugin or .component == $legacy_plugin) | .version')
export DESCRIPTION="$(git describe --all --exact-match `git rev-parse HEAD`)"
if [[ $DESCRIPTION == 'tags/'$REPORTED_VERSION ]]; then
export VERSION=${REPORTED_VERSION}
else
export EPOCH="$(date +%s)"
export VERSION=${REPORTED_VERSION}${EPOCH}
fi
export response=$(curl --write-out %{http_code} --silent --output /dev/null https://pypi.org/project/pulp-python-client/$VERSION/)
if [ "$response" == "200" ];
then
echo "pulp_python client $VERSION has already been released. Installing from PyPI."
docker exec pulp pip3 install pulp-python-client==$VERSION
mkdir -p dist
tar cvf python-client.tar ./dist
exit
fi
cd ../pulp-openapi-generator
rm -rf pulp_python-client
./generate.sh pulp_python python $VERSION
cd pulp_python-client
python setup.py sdist bdist_wheel --python-tag py3
find . -name "*.whl" -exec docker exec pulp pip3 install /root/pulp-openapi-generator/pulp_python-client/{} \;
tar cvf ../../pulp_python/python-client.tar ./dist
find ./docs/* -exec sed -i 's/Back to README/Back to HOME/g' {} \;
find ./docs/* -exec sed -i 's/README//g' {} \;
cp README.md docs/index.md
sed -i 's/docs\///g' docs/index.md
find ./docs/* -exec sed -i 's/\.md//g' {} \;
tar cvf ../../pulp_python/python-client-docs.tar ./docs
exit $?