Skip to content

Commit b7ddb1b

Browse files
committed
Fixes #2031
1 parent 203f792 commit b7ddb1b

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

conf/build.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CONF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2121

2222
build_docs=0
2323
build_docker=0
24+
offline=0
2425

2526
. "${CONF_DIR}/env.sh"
2627

@@ -32,6 +33,9 @@ while [[ $# -ne 0 ]]; do
3233
docker)
3334
build_docker=1
3435
;;
36+
offline)
37+
offline=1
38+
;;
3539
*)
3640
;;
3741
esac
@@ -41,9 +45,18 @@ done
4145
echo "======= FORMATTING CODE ========="
4246
ruff format
4347
echo "======= BUILDING PACKAGE ========="
44-
rm -rf "${ROOT_DIR}/build/lib/sonar" "${ROOT_DIR}/build/lib/cli" "${ROOT_DIR}"/build/scripts*/sonar-tools "${ROOT_DIR}"/dist/sonar_tools*
45-
# python -m build
46-
poetry build
48+
if [[ "${offline}" = "1" ]]; then
49+
cp "${ROOT_DIR}/conf/offline/setup.py" "${ROOT_DIR}/"
50+
cp "${ROOT_DIR}/conf/offline/sonar-tools" "${ROOT_DIR}/"
51+
mv "${ROOT_DIR}/pyproject.toml" "${ROOT_DIR}/pyproject.toml.bak"
52+
python setup.py bdist_wheel
53+
mv "${ROOT_DIR}/pyproject.toml.bak" "${ROOT_DIR}/pyproject.toml"
54+
rm "${ROOT_DIR}/setup.py" "${ROOT_DIR}/sonar-tools" "${ROOT_DIR}/sonar_tools.egg-info"
55+
# python -m build
56+
else
57+
rm -rf "${ROOT_DIR}/build/lib/sonar" "${ROOT_DIR}/build/lib/cli" "${ROOT_DIR}"/build/scripts*/sonar-tools "${ROOT_DIR}"/dist/sonar_tools*
58+
poetry build
59+
fi
4760

4861
if [[ "${build_docs}" = "1" ]]; then
4962
echo "======= BUILDING DOCS ========="

0 commit comments

Comments
 (0)