From 297bc5562db5434f9e329a953ea5267b9c95edcc Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Mon, 28 Aug 2023 09:32:00 +0300 Subject: [PATCH] refactor --- build.sh | 56 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/build.sh b/build.sh index 21c697e..3ef54c0 100755 --- a/build.sh +++ b/build.sh @@ -2,10 +2,10 @@ qt6_build() { - python3 setup.py build --parallel "$(nproc)" --limited-api yes - export dir_name=qfpa-py${PYTHON_VERSION}-qt${QT_VERSION}-64bit-release - tar czvf "/output/$dir_name.tar.gz" -C "./build/$dir_name/install" . python3 setup.py build --parallel "$(nproc)" bdist_wheel --limited-api yes + export dir_name=qfpa-py${PYTHON_VERSION}-qt${QT_VERSION}-64bit-release + export archive_name=extra-${PYTHON_PLATFORM} + tar czvf "/output/$dir_name.tar.gz" -C "./build/$dir_name/install" . cp ./dist/* /output } @@ -15,23 +15,39 @@ qt5_build() exit 1 } -mkdir -p /output +get_variables() +{ + export PYTHON_PLATFORM=$(python3 -c "from packaging.tags import sys_tags; print(next(sys_tags()).platform.lower().replace(\"-\", \"_\").replace(\".\", \"_\").replace(\" \", \"_\"))") +} -cd /opt \ - && git clone -b ${QT_VERSION} https://code.qt.io/pyside/pyside-setup.git \ - && cd pyside-setup \ - && pip3 install -r requirements.txt +init() +{ + get_variables + + mkdir -p /output + + cd /opt \ + && git clone -b ${QT_VERSION} https://code.qt.io/pyside/pyside-setup.git \ + && cd pyside-setup \ + && pip3 install -r requirements.txt +} + +main() +{ + init + + case $QT_VERSION in + 6*) + qt6_build + ;; + 5*) + qt5_build + ;; + *) + echo "Unsupported version of QT" + exit 1 + ;; + esac +} -case $QT_VERSION in - 6*) - qt6_build - ;; - 5*) - qt5_build - ;; - *) - echo "Unsupported version of QT" - exit 1 - ;; -esac