Skip to content

Commit d3520a8

Browse files
committed
added script to build pymgclient
1 parent 3b3decd commit d3520a8

3 files changed

Lines changed: 62 additions & 16 deletions

File tree

.github/workflows/reusable_buildtest.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- {platform: 'ubuntu-24.04', python_version: '3.12', mgversion: 'latest', arch: 'x86_64'}
4242
- {platform: 'ubuntu-24.04', python_version: '3.13', mgversion: 'latest', arch: 'x86_64'}
4343
- {platform: 'ubuntu-24.04', python_version: '3.14', mgversion: 'latest', arch: 'x86_64'}
44-
- {platform: 'fedora-41', python_version: '3.14', mgversion: 'latest', arch: 'x86_64'}
44+
- {platform: 'fedora-42', python_version: '3.14', mgversion: 'latest', arch: 'x86_64'}
4545
- {platform: 'ubuntu-24.04', python_version: '3.10', mgversion: 'latest', arch: 'aarch64'}
4646
- {platform: 'ubuntu-24.04', python_version: '3.11', mgversion: 'latest', arch: 'aarch64'}
4747
- {platform: 'ubuntu-24.04', python_version: '3.12', mgversion: 'latest', arch: 'aarch64'}
@@ -66,7 +66,7 @@ jobs:
6666
6767
- name: Download Memgraph
6868
run: |
69-
if [[ "${{ matrix.platform }}" == "fedora-41" ]]; then
69+
if [[ "${{ matrix.platform }}" == "fedora-42" ]]; then
7070
MEMGRAPH_PACKAGE_NAME="memgraph-${{ env.MGVERSION }}_1-1.${{ matrix.arch }}.rpm"
7171
LOCAL_PACKAGE_NAME=memgraph.rpm
7272
else
@@ -106,12 +106,8 @@ jobs:
106106
if [[ "${{ matrix.platform }}" == "ubuntu-24.04" ]]; then
107107
# this option is specific to ubuntu, not fedora
108108
break_packages="--break-system-packages"
109-
elif [[ "${{ matrix.platform }}" == fedora* ]]; then
110-
# rpm distros do not ship with static lib for openssl
111-
static_ssl="-C--build-option=build_ext --C--build-option=--static-openssl=False"
112109
fi
113110
echo "BREAK_PACKAGES=$break_packages" >> $GITHUB_ENV
114-
echo "STATIC_SSL=$static_ssl" >> $GITHUB_ENV
115111
116112
- name: Copy Repo Into Container
117113
run: |
@@ -130,7 +126,7 @@ jobs:
130126
bash -c "cd /pymgclient && ./tools/install_linux_deps.sh ${{ matrix.platform }} --python-version ${{ matrix.python_version }} --force-update"
131127
132128
# Install Memgraph package
133-
if [[ "${{ matrix.platform }}" == "fedora-41" ]]; then
129+
if [[ "${{ matrix.platform }}" == "fedora-42" ]]; then
134130
docker exec -i testcontainer \
135131
bash -c "dnf install -y /$LOCAL_PACKAGE_NAME"
136132
else
@@ -142,15 +138,12 @@ jobs:
142138

143139
- name: Build Python Wheel
144140
run: |
141+
build_cmd="./tools/build-wheel.sh --python-version ${{ matrix.python_version }}"
142+
if [[ ${{ matrix.platform }} == "ubuntu-24.04" ]]; then
143+
build_cmd+=" --static-ssl --run-auditwheel"
144+
fi
145145
docker exec -i testcontainer \
146-
bash -c "cd /pymgclient && python${{ matrix.python_version }} setup.py ${{ env.STATIC_SSL }} bdist_wheel"
147-
148-
- name: Audit Wheel
149-
if: ${{ matrix.platform == 'ubuntu-24.04' }}
150-
run: |
151-
docker exec -i testcontainer \
152-
bash -c "cd /pymgclient && auditwheel repair dist/*.whl --plat manylinux_2_39_${{ matrix.arch == 'x86_64' && 'x86_64' || 'aarch64' }} -w dist/ && rm dist/*linux_${{ matrix.arch == 'x86_64' && 'x86_64' || 'aarch64' }}.whl"
153-
146+
bash -c "cd /pymgclient && $build_cmd"
154147
155148
- name: Install pymgclient
156149
run: |

tools/build-wheel.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
python_version="3.14"
4+
static_ssl=false
5+
use_env=false
6+
run_auditwheel=false
7+
while [ $# -gt 0 ]; do
8+
case "$1" in
9+
--python-version)
10+
python_version="$2"
11+
shift 2
12+
;;
13+
--static-ssl)
14+
static_ssl=true
15+
shift
16+
;;
17+
--use-env)
18+
use_env=true
19+
shift
20+
;;
21+
--run-auditwheel)
22+
run_auditwheel=true
23+
shift
24+
;;
25+
*)
26+
echo "Unknown option: $1"
27+
exit 1
28+
;;
29+
esac
30+
done
31+
32+
echo "Building wheel for Python $python_version with static SSL: $static_ssl"
33+
34+
PYTHON_BINARY="python$python_version"
35+
36+
if $use_env; then
37+
$PYTHON_BINARY -m venv env
38+
source env/bin/activate
39+
pip install build auditwheel setuptools wheel
40+
fi
41+
42+
args=()
43+
if ! $static_ssl; then
44+
args+=("-C--build-option=build_ext" "-C--build-option=--static-openssl=False")
45+
fi
46+
47+
$PYTHON_BINARY -m build "${args[@]}"
48+
49+
if $run_auditwheel; then
50+
ARCH="$(arch)"
51+
cp_version=$(echo $python_version | sed 's/\.//g')
52+
auditwheel repair dist/*cp${cp_version}*.whl --plat manylinux_2_39_${ARCH} -w dist/ && rm dist/*linux_${ARCH}.whl
53+
fi

tools/install_linux_deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ esac
185185
186186
# install python dependencies
187187
export PIP_BREAK_SYSTEM_PACKAGES=1
188-
pkgs=(networkx pytest pyopenssl sphinx setuptools wheel auditwheel tzdata)
188+
pkgs=(networkx pytest pyopenssl sphinx setuptools wheel auditwheel tzdata build)
189189
if [[ $force_update == true ]]; then
190190
"$python_binary" -m pip install --upgrade --ignore-installed ${pkgs[@]}
191191
else

0 commit comments

Comments
 (0)