Skip to content

Commit 9de5459

Browse files
Meta: Install libsemigroups before building sdist
This change is sub-optimal, since libsemigroups is not required to build an sdist; however, libsemigroups is required to build the wheels. With the setup we have (using setuptools as a build-backend), there is no out-of-the box way to move this non-python dependency out of setup.py. As setup.py is executed when building both sdists and wheels, we need to libsemigroups to be available in both stages. An alternative option would be to modify setuptools.build_meta and write custom build_sdist and build_wheel functions (see PEP 517), but this really didn't seem worth it.
1 parent 951c194 commit 9de5459

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
- uses: actions/setup-python@v5
2828
- name: Install cibuildwheel
2929
run: python -m pip install cibuildwheel==3.0.1
30+
- name: Install libsemigroups
31+
run: etc/install-libsemigroups.sh
3032
- name: Build wheels
3133
run: python -m cibuildwheel --output-dir wheelhouse
3234
- uses: actions/upload-artifact@v4
@@ -40,6 +42,8 @@ jobs:
4042
steps:
4143
- uses: actions/checkout@v4
4244
- uses: actions/setup-python@v5
45+
- name: Install libsemigroups
46+
run: etc/install-libsemigroups.sh
4347
- name: Build SDist
4448
run: pipx run build --sdist
4549
- uses: actions/upload-artifact@v4

etc/install-libsemigroups.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# If a command fails, exit this script with an error code
4+
set -e
5+
set -o pipefail
6+
7+
VERSION=$(python etc/libsemigroups_version.py)
8+
curl -L -O https://github.com/libsemigroups/libsemigroups/releases/download/v$VERSION/libsemigroups-$VERSION.tar.gz
9+
tar -xf libsemigroups-$VERSION.tar.gz
10+
rm -f libsemigroups-$VERSION.tar.gz
11+
cd libsemigroups-$VERSION
12+
./configure --disable-hpcombi
13+
make -j4 && sudo make install

pyproject.toml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,8 @@ dev = [
102102
[tool.cibuildwheel]
103103
test-groups = ["test"]
104104
test-command = "pytest {project}/tests"
105-
build-frontend = "build[uv]"
105+
build-frontend = "build"
106106
build-verbosity = 1
107-
before-all = ["VERSION=$(python etc/libsemigroups_version.py)",
108-
"curl -L -O https://github.com/libsemigroups/libsemigroups/releases/download/v$VERSION/libsemigroups-$VERSION.tar.gz",
109-
"tar -xf libsemigroups-$VERSION.tar.gz",
110-
"rm -f libsemigroups-$VERSION.tar.gz",
111-
"cd libsemigroups-$VERSION",
112-
"./configure --disable-hpcombi",
113-
"make -j14 && make install"]
114107

115108
[tool.cibuildwheel.linux]
116109
environment= "LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/lib:/usr/local/lib' PKG_CONFIG_PATH='$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig'"

0 commit comments

Comments
 (0)