mirror of
https://github.com/python-LimeReport/pyside.git
synced 2024-12-24 15:04:40 +03:00
add windows build
This commit is contained in:
parent
0ded3ecf95
commit
4c1c822099
24
.github/workflows/blank.yml
vendored
24
.github/workflows/blank.yml
vendored
@ -23,8 +23,30 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Build
|
||||
run: ./build.sh
|
||||
run: python build.py
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: /output/*
|
||||
|
||||
build_windows:
|
||||
name: Build on Windows (Qt ${{ matrix.qt }})
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
qt: 6.4.2
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Build
|
||||
run: python build.py
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
44
build.py
Normal file
44
build.py
Normal file
@ -0,0 +1,44 @@
|
||||
import subprocess
|
||||
import os
|
||||
import shutil
|
||||
import tarfile
|
||||
|
||||
def qt6_build():
|
||||
subprocess.run(["python3", "setup.py", "build", "--parallel", str(os.cpu_count()), "bdist_wheel", "--limited-api", "yes"], check=True)
|
||||
dir_name = f'qfpa-py{os.environ["PYTHON_VERSION"]}-qt{os.environ["QT_VERSION"]}-64bit-release'
|
||||
archive_name = f'extra-{os.environ["PYTHON_PLATFORM"]}'
|
||||
with tarfile.open(f'/output/{archive_name}.tar.gz', 'w:gz') as tar:
|
||||
tar.add(f'./build/{dir_name}/install', arcname='.')
|
||||
shutil.copytree('./dist', '/output', dirs_exist_ok=True)
|
||||
|
||||
def qt5_build():
|
||||
print("Not implemented")
|
||||
exit(1)
|
||||
|
||||
def get_variables():
|
||||
result = subprocess.run(["python3", "-c", "from packaging.tags import sys_tags; print(next(sys_tags()).platform.lower().replace('-', '_').replace('.', '_').replace(' ', '_'))"], capture_output=True, text=True)
|
||||
os.environ["PYTHON_PLATFORM"] = result.stdout.strip()
|
||||
|
||||
def init():
|
||||
get_variables()
|
||||
|
||||
os.makedirs('/output', exist_ok=True)
|
||||
|
||||
os.chdir('/opt')
|
||||
subprocess.run(["git", "clone", "-b", os.environ["QT_VERSION"], "https://code.qt.io/pyside/pyside-setup.git"], check=True)
|
||||
os.chdir('pyside-setup')
|
||||
subprocess.run(["pip3", "install", "-r", "requirements.txt"], check=True)
|
||||
|
||||
def main():
|
||||
init()
|
||||
|
||||
if os.environ["QT_VERSION"].startswith("6"):
|
||||
qt6_build()
|
||||
elif os.environ["QT_VERSION"].startswith("5"):
|
||||
qt5_build()
|
||||
else:
|
||||
print("Unsupported version of QT")
|
||||
exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
53
build.sh
53
build.sh
@ -1,53 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
qt6_build()
|
||||
{
|
||||
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/$archive_name.tar.gz" -C "./build/$dir_name/install" .
|
||||
cp ./dist/* /output
|
||||
}
|
||||
|
||||
qt5_build()
|
||||
{
|
||||
echo "Not implemented"
|
||||
exit 1
|
||||
}
|
||||
|
||||
get_variables()
|
||||
{
|
||||
export PYTHON_PLATFORM=$(python3 -c "from packaging.tags import sys_tags; print(next(sys_tags()).platform.lower().replace(\"-\", \"_\").replace(\".\", \"_\").replace(\" \", \"_\"))")
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
main
|
Loading…
Reference in New Issue
Block a user