Skip to content

Commit 3bdb5f1

Browse files
committed
Improve error message about upper Flint cap
1 parent 26f2b4b commit 3bdb5f1

File tree

1 file changed

+34
-11
lines changed

1 file changed

+34
-11
lines changed

meson.build

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
project('python-flint', 'cython', 'c')
22

3+
py = import('python').find_installation(pure: false)
4+
dep_py = py.dependency()
5+
6+
cc = meson.get_compiler('c')
7+
8+
flint_ver_lower = '3.0' # >=3.0
9+
flint_ver_upper = '3.2' # <3.2
10+
11+
gmp_dep = dependency('gmp')
12+
mpfr_dep = dependency('mpfr')
13+
flint_dep = dependency('flint', version: ['>=' + flint_ver_lower])
14+
315
#
416
# For the source release, we should by default fail for newer versions of Flint
517
# that are untested with a nice error message:
@@ -13,20 +25,31 @@ project('python-flint', 'cython', 'c')
1325
# that future versions of Flint will not work.
1426
#
1527
if get_option('flint_version_check')
16-
flint_version_required = ['>=3.0', '<3.2']
17-
else
18-
# We do know that Flint < 3.0 will not work so no point allowing it.
19-
flint_version_required = ['>=3.0']
20-
endif
28+
if flint_dep.version().version_compare('>=' + flint_ver_upper)
29+
error('''
2130
22-
py = import('python').find_installation(pure: false)
23-
dep_py = py.dependency()
31+
Invalid Flint version:
32+
Version needed is: @0@ <= flint < @1@
33+
Version found is: flint == @2@
2434
25-
cc = meson.get_compiler('c')
35+
By default, python-flint will only build against Flint versions that have
36+
been tested. If you are sure you want to use this version of Flint, you
37+
can disable this check with -Dflint_version_check=false.
2638
27-
gmp_dep = dependency('gmp')
28-
mpfr_dep = dependency('mpfr')
29-
flint_dep = dependency('flint', version: flint_version_required)
39+
If building from the source directory using meson directly, you can do
40+
this with:
41+
42+
meson setup build -Dflint_version_check=false
43+
44+
If you are installing with pip, you can do this with:
45+
46+
pip install --config-settings=setup-args="-Dflint_version_check=false" python-flint
47+
48+
Other build frontends have similar options for passing this to meson.
49+
'''.format(flint_ver_lower, flint_ver_upper, flint_dep.version())
50+
)
51+
endif
52+
endif
3053

3154
add_project_arguments(
3255
'-X', 'embedsignature=True',

0 commit comments

Comments
 (0)