Skip to content

Commit cddb32e

Browse files
Merge pull request #136 from oscarbenjamin/pr_ubuntu_build
maint: add CI check to build against Ubuntu Flint deb
2 parents 57b7386 + 577babe commit cddb32e

4 files changed

Lines changed: 78 additions & 97 deletions

File tree

.github/workflows/buildwheel.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,36 +120,38 @@ jobs:
120120
- run: pip install --no-index --find-links wheelhouse python_flint
121121
- run: python -m flint.test --verbose
122122

123-
test_pip_vcs_sdist:
124-
name: pip install ${{ matrix.target }} on ${{ matrix.python-version }}
125-
runs-on: ubuntu-22.04
123+
# On new enough Ubuntu we can build against the system deb.
124+
test_pip_flint_deb:
125+
name: Build on ${{ matrix.os }}
126+
runs-on: ${{ matrix.os }}
126127
strategy:
127128
fail-fast: false
128129
matrix:
129-
python-version: ['3.11', '3.12', '3.13-dev']
130-
# '.' means install from python-flint git checkout
131-
# 'python-flint' means install from PyPI sdist
132-
target: ['.', 'python-flint']
130+
os: [ubuntu-24.04]
133131
steps:
134132
- uses: actions/checkout@v4
135133
- uses: actions/setup-python@v5
136134
with:
137-
python-version: ${{ matrix.python-version }}
138-
- run: bin/pip_install_ubuntu.sh ${{ matrix.target }}
135+
python-version: '3.12'
136+
- run: sudo apt-get update
137+
- run: sudo apt-get install libflint-dev
138+
- run: pip install .
139139
- run: python -m flint.test --verbose
140140

141+
# For older Ubuntu we have to build Flint >= 3.0.0
141142
test_flint_versions:
142-
name: Test flint ${{ matrix.flinttag }}
143+
name: Test flint ${{ matrix.flint-tag }}
143144
runs-on: ubuntu-22.04
144145
strategy:
145146
fail-fast: false
146147
matrix:
147148
# Supported versions and latest git
148-
flinttag: ['v3.0.0', 'v3.0.1', 'v3.1.0', 'main']
149+
flint-tag: ['v3.0.0', 'v3.0.1', 'v3.1.0', 'v3.1.1', 'v3.1.2', 'main']
149150
steps:
150151
- uses: actions/checkout@v4
151152
- uses: actions/setup-python@v5
152153
with:
153-
python-version: 3.12
154-
- run: bin/pip_install_ubuntu.sh . ${{ matrix.flinttag }}
154+
python-version: '3.12'
155+
- run: bin/install_flint_ubuntu.sh ${{ matrix.flint-tag }}
156+
- run: pip install .
155157
- run: python -m flint.test --verbose

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,20 @@ First install FLINT 3. Starting with python-flint 0.5.0 older versions of Flint
4040
such as 2.9 are not supported any more. Note that as of Flint 3 Arb no longer
4141
needs to be built separately as it is now merged into Flint.
4242

43-
See here for instructions on building FLINT:
43+
As of e.g. Ubuntu 24.04 a new enough version of FLINT (at least version 3) can
44+
be installed from the Ubuntu repos like
45+
46+
sudo apt-get install libflint-dev
47+
48+
For older distros the version in the repos is too old and a newer version of
49+
FLINT needs to be built. See here for instructions on building FLINT:
4450

4551
* http://flintlib.org/
4652

53+
A script that builds and installs FLINT on Ubuntu can be found here:
54+
55+
* https://github.com/flintlib/python-flint/blob/master/bin/install_flint_ubuntu.sh
56+
4757
The latest release of Python-FLINT can then be built from source and installed
4858
using:
4959

@@ -54,11 +64,6 @@ as follows:
5464

5565
pip install .
5666

57-
A script that builds and installs FLINT and python-flint that is tested on
58-
Ubuntu can be found in the git repo here:
59-
60-
* https://github.com/flintlib/python-flint/blob/master/bin/pip_install_ubuntu.sh
61-
6267
See the documentation for further notes on building and installing
6368
python-flint:
6469

bin/install_flint_ubuntu.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
5+
#
6+
# This script should work to build and install Flint from git on Ubuntu
7+
#
8+
# $ git clone https://github.com/flintlib/python-flint.git
9+
# $ cd python-flint
10+
# $ bin/install_flint_ubuntu.sh v3.1.0
11+
#
12+
# The version is a tag or branch in the Flint repository.
13+
#
14+
# Then to install an sdist from PyPI, use
15+
#
16+
# $ pip install python-flint
17+
#
18+
# To install python-flint from the git checkout
19+
#
20+
# $ pip install .
21+
#
22+
23+
echo "Building from git: $1"
24+
GIT_REF=$1
25+
26+
# Install runtime and build dependencies
27+
28+
# First install their dependencies and build dependencies
29+
sudo apt-get update
30+
sudo apt-get install libgmp-dev libmpfr-dev xz-utils ninja-build
31+
32+
#
33+
# This will default to installing in /usr/local. If you want to install in a
34+
# non-standard location then configure flint with
35+
# ./configure --disable-static --prefix=$PREFIX
36+
# If $PREFIX is not in default search paths, then at build time set
37+
# export C_INCLUDE_PATH=$PREFIX/include
38+
# and at runtime set
39+
# export LD_LIBRARY_PATH=$PREFIX/lib
40+
#
41+
echo "Installing Flint from git: $GIT_REF"
42+
git clone https://github.com/flintlib/flint.git
43+
cd flint
44+
git checkout $GIT_REF
45+
./bootstrap.sh
46+
./configure --disable-static
47+
make -j
48+
sudo make install
49+
cd ..
50+
51+
ls -l /usr/local/lib
52+
sudo ldconfig /usr/local/lib

bin/pip_install_ubuntu.sh

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)