1
1
project (' python-flint' , ' cython' , ' c' )
2
+ #
3
+ # The minimum versions are because we know that it will not work with earlier
4
+ # versions. The maximum versions are because python-flint was not tested
5
+ # against future versions that didn't exist at the time of release. In future
6
+ # if it seems like new releases do not always break the build of python-flint
7
+ # then we can consider not using a speculative upper version cap here.
8
+ #
9
+ flint_lower = ' >=3.0'
10
+ flint_upper = ' <3.2'
11
+ cython_lower = ' >=3.0'
12
+ cython_upper = ' <3.2'
2
13
3
14
py = import (' python' ).find_installation(pure : false )
4
15
dep_py = py.dependency ()
5
16
6
17
cc = meson .get_compiler(' c' )
7
-
8
- flint_ver_lower = ' 3.0' # >=3.0
9
- flint_ver_upper = ' 3.2' # <3.2
18
+ cy = meson .get_compiler(' cython' )
10
19
11
20
gmp_dep = dependency (' gmp' )
12
21
mpfr_dep = dependency (' mpfr' )
13
- flint_dep = dependency (' flint' , version : [ ' >= ' + flint_ver_lower] )
22
+ flint_dep = dependency (' flint' )
14
23
15
24
#
16
- # The minimum Flint version is because we know that it will not work with
17
- # earlier versions. The maximum version is because python-flint has not been
18
- # tested against versions that didn't exist at the time of release. In future
19
- # if it seems like new Flint releases do not break the build of python-flint
20
- # every time, then we can consider not using a speculative upper version cap
21
- # here.
22
- #
23
- # For the source release, we should by default fail for newer versions of Flint
24
- # that are untested with a nice error message.
25
+ # For the source release, we should by default fail for new untested versions
26
+ # with a clear error message about the version mismatch.
25
27
#
26
28
# We need an option to disable this though so that we can test newer versions
27
29
# of Flint. Also good to have an escape hatch for users since we don't know
28
30
# that future versions of Flint will not work.
29
31
#
30
- if get_option (' flint_version_check' )
31
- if flint_dep.version().version_compare(' >=' + flint_ver_upper)
32
- error ('''
32
+ ver_message = '''
33
+
34
+ Invalid @0@ version:
35
+ Version needed is: @0@ @2@, @3@
36
+ Version found is: @0@ == @1@
33
37
34
- Invalid Flint version:
35
- Version needed is: @0@ <= flint < @1@
36
- Version found is: flint == @2@
38
+ By default, python-flint will only build against @0@ versions that have
39
+ been tested. If you are sure you want to use this version of @0@, you can
40
+ disable this check with -Dflint_version_check=false.
37
41
38
- By default, python-flint will only build against Flint versions that have
39
- been tested. If you are sure you want to use this version of Flint, you can
40
- disable this check with -Dflint_version_check=false.
42
+ If building from the source directory using meson directly, you can do this
43
+ with:
41
44
42
- If building from the source directory using meson directly, you can do this
43
- with:
45
+ meson setup build -Dflint_version_check=false
44
46
45
- meson setup build -Dflint_version_check=false
47
+ If you are installing with pip, you can do this with:
46
48
47
- If you are installing with pip, you can do this with:
49
+ pip install --config-settings=setup-args="-Dflint_version_check=false" python-flint
48
50
49
- pip install --config-settings=setup-args="-Dflint_version_check=false" python-flint
51
+ Other build frontends have similar options for passing this to meson.
50
52
51
- Other build frontends have similar options for passing this to meson.
52
- ''' .format(flint_ver_lower, flint_ver_upper, flint_dep.version()))
53
+ '''
54
+ if get_option (' flint_version_check' )
55
+ if not (flint_dep.version().version_compare(flint_lower) and
56
+ flint_dep.version().version_compare(flint_upper))
57
+ error (ver_message.format(' FLINT' , flint_dep.version(), flint_lower, flint_upper))
53
58
endif
59
+ if not (cy.version().version_compare(cython_lower) and
60
+ cy.version().version_compare(cython_upper))
61
+ error (ver_message.format(' Cython' , cy.version(), cython_lower, cython_upper))
62
+ endif
63
+ endif
64
+
65
+ # flint.pc was missing -lflint until Flint 3.1.0
66
+ if flint_dep.version().version_compare(' <3.1' )
67
+ flint_dep = cc.find_library (' flint' )
68
+ have_acb_theta = false
69
+ else
70
+ have_acb_theta = true
54
71
endif
55
72
73
+ pyflint_deps = [dep_py, gmp_dep, mpfr_dep, flint_dep]
74
+
56
75
add_project_arguments (
57
76
' -X' , ' embedsignature=True' ,
58
77
' -X' , ' emit_code_comments=True' ,
@@ -74,14 +93,4 @@ if get_option('add_flint_rpath')
74
93
)
75
94
endif
76
95
77
- # flint.pc was missing -lflint until Flint 3.1.0
78
- if flint_dep.version().version_compare(' <3.1' )
79
- flint_dep = cc.find_library (' flint' )
80
- have_acb_theta = false
81
- else
82
- have_acb_theta = true
83
- endif
84
-
85
- pyflint_deps = [dep_py, gmp_dep, mpfr_dep, flint_dep]
86
-
87
96
subdir (' src/flint' )
0 commit comments