|
1 |
| -diff --git a/meson.build b/meson.build |
2 |
| -index ad18b245..24108760 100644 |
3 |
| ---- a/meson.build |
4 |
| -+++ b/meson.build |
5 |
| -@@ -11,7 +11,7 @@ project( |
6 |
| - 'buildtype=debugoptimized', |
7 |
| - 'c_std=c99', |
8 |
| - 'cpp_std=c++14', |
9 |
| -- 'fortran_std=legacy', |
10 |
| -+ 'fortran_std=none', |
11 |
| - 'blas=openblas', |
12 |
| - 'lapack=openblas' |
13 |
| - ], |
14 |
| -@@ -66,6 +66,10 @@ if ff.has_argument('-Wno-conversion') |
15 |
| - add_project_arguments('-Wno-conversion', language: 'fortran') |
16 |
| - endif |
17 |
| - |
18 |
| -+if ff.has_argument('-fallow-argument-mismatch') |
19 |
| -+ add_project_arguments('-fallow-argument-mismatch', language: 'fortran') |
20 |
| -+endif |
21 |
| -+ |
22 |
| - is_windows = host_machine.system() == 'windows' |
23 |
| - |
24 |
| - # Intel compilers default to fast-math, so disable it if we detect Intel |
25 |
| -diff --git a/mesonpy_wrapper.py b/mesonpy_wrapper.py |
26 |
| -new file mode 100644 |
27 |
| -index 00000000..afa33ecc |
28 |
| ---- /dev/null |
29 |
| -+++ b/mesonpy_wrapper.py |
30 |
| -@@ -0,0 +1,86 @@ |
31 |
| -+import mesonpy |
32 |
| -+import os |
33 |
| -+import sys |
34 |
| -+from contextlib import contextmanager |
35 |
| -+import subprocess |
36 |
| -+ |
37 |
| -+ |
38 |
| -+def get_flang_new_lib_dir(): |
39 |
| -+ if sys.implementation.name == "graalpy" and __graalpython__.use_system_toolchain: |
40 |
| -+ return None, None |
41 |
| -+ try: |
42 |
| -+ output = subprocess.check_output(['flang-new', '--version']) |
43 |
| -+ flang_dir = output.splitlines()[-1].split()[-1].strip().decode("utf-8") |
44 |
| -+ return os.path.join(flang_dir, "flang-new"), os.path.normpath(os.path.join(flang_dir, '..', 'lib')) |
45 |
| -+ except Exception as e: |
46 |
| -+ print(f"INFO: flang-new not detected, could not find library path. Reason: {e}") |
47 |
| -+ return None, None |
48 |
| -+ |
49 |
| -+ |
50 |
| -+def append_env_var(env, var, value): |
51 |
| -+ env[var] = '{} {}'.format(env.get(var, ''), value) |
52 |
| -+ |
53 |
| -+ |
54 |
| -+def get_build_env(): |
55 |
| -+ env = {} |
56 |
| -+ flang_new, flang_lib_dir = get_flang_new_lib_dir() |
57 |
| -+ if flang_new: |
58 |
| -+ # until flang-new can compile propack we disable it (during runtime) |
59 |
| -+ env["USE_PROPACK"] = "0" |
60 |
| -+ env['CC'] = 'clang' |
61 |
| -+ env['CXX'] = 'clang++' |
62 |
| -+ # env['FC'] = flang_new |
63 |
| -+ env['FC'] = "flang-new" |
64 |
| -+ if sys.implementation.name == "graalpy": |
65 |
| -+ cflags = "-flto=full" |
66 |
| -+ else: |
67 |
| -+ ld = 'lld' |
68 |
| -+ cflags = "-flto=full -fuse-ld=lld -Wl,--mllvm=-lto-embed-bitcode=optimized,--lto-O0" |
69 |
| -+ env['CC_LD'] = ld |
70 |
| -+ env['CXX_LD'] = ld |
71 |
| -+ env['FC_LD'] = ld |
72 |
| -+ env['CFLAGS'] = cflags |
73 |
| -+ env['CXXFLAGS'] = cflags |
74 |
| -+ env['FFLAGS'] = cflags |
75 |
| -+ append_env_var(env, 'LDFLAGS', f'-L{flang_lib_dir}') |
76 |
| -+ return env |
77 |
| -+ |
78 |
| -+ |
79 |
| -+@contextmanager |
80 |
| -+def env_vars(env): |
81 |
| -+ # save and set |
82 |
| -+ prev = {} |
83 |
| -+ for k, v in env.items(): |
84 |
| -+ prev[k] = os.environ.get(k, None) |
85 |
| -+ os.environ[k] = v |
86 |
| -+ |
87 |
| -+ yield |
88 |
| -+ |
89 |
| -+ # restore |
90 |
| -+ for k, v in prev.items(): |
91 |
| -+ if v is None: |
92 |
| -+ del os.environ[k] |
93 |
| -+ else: |
94 |
| -+ os.environ[k] = v |
95 |
| -+ |
96 |
| -+ |
97 |
| -+def get_config_settings(config_settings=None): |
98 |
| -+ if config_settings is None: |
99 |
| -+ config_settings = {} |
100 |
| -+ config_settings['compile-args'] = '-j4' |
101 |
| -+ config_settings['builddir'] = f'mesonbuild-{sys.implementation.name}' |
102 |
| -+ return config_settings |
103 |
| -+ |
104 |
| -+ |
105 |
| -+def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): |
106 |
| -+ config_settings = get_config_settings(config_settings) |
107 |
| -+ scipy_build_env = get_build_env() |
108 |
| -+ with env_vars(scipy_build_env): |
109 |
| -+ return mesonpy.build_wheel(wheel_directory, config_settings=config_settings, metadata_directory=metadata_directory) |
110 |
| -+ |
111 |
| -+ |
112 |
| -+def build_sdist(sdist_directory, config_settings=None): |
113 |
| -+ config_settings = get_config_settings(config_settings) |
114 |
| -+ scipy_build_env = get_build_env() |
115 |
| -+ with env_vars(scipy_build_env): |
116 |
| -+ return mesonpy.build_sdist(sdist_directory, config_settings=config_settings) |
117 | 1 | diff --git a/pyproject.toml b/pyproject.toml
|
118 |
| -index 454a3c2e..94a754aa 100644 |
| 2 | +index 454a3c2e..7c96eb11 100644 |
119 | 3 | --- a/pyproject.toml
|
120 | 4 | +++ b/pyproject.toml
|
121 |
| -@@ -8,55 +8,21 @@ |
122 |
| - # "pybind11>=2.4.3,<2.5.0", |
123 |
| - |
124 |
| - [build-system] |
125 |
| --build-backend = 'mesonpy' |
126 |
| -+# build-backend = 'mesonpy' |
127 |
| -+build-backend = 'mesonpy_wrapper' |
128 |
| -+backend-path = ["."] |
129 |
| - requires = [ |
130 |
| - "meson-python>=0.11.0,<0.13.0", |
131 |
| - "Cython>=0.29.32,<3.0", |
| 5 | +@@ -15,48 +15,11 @@ requires = [ |
132 | 6 | # conservatively avoid issues from
|
133 | 7 | # https://github.com/pybind/pybind11/issues/4420
|
134 | 8 | "pybind11==2.10.1",
|
135 | 9 | - "pythran>=0.12.0,<0.13.0",
|
136 |
| -+ "pythran>=0.13.0", |
| 10 | ++ "pythran==0.13.1", |
137 | 11 | # `wheel` is needed for non-isolated builds, given that `meson-python`
|
138 | 12 | # doesn't list it as a runtime requirement (at least in 0.5.0)
|
139 | 13 | "wheel<0.39.0",
|
@@ -176,159 +50,6 @@ index 454a3c2e..94a754aa 100644
|
176 | 50 | - "numpy; python_version>='3.12'",
|
177 | 51 | - "numpy; python_version>='3.8' and platform_python_implementation=='PyPy'",
|
178 | 52 | + "numpy==1.23.5",
|
179 |
| -+ "ninja", |
180 | 53 | ]
|
181 | 54 |
|
182 | 55 | [project]
|
183 |
| -diff --git a/scipy/_lib/_ccallback_c.pyx b/scipy/_lib/_ccallback_c.pyx |
184 |
| -index 0704acc6..beb2bc72 100644 |
185 |
| ---- a/scipy/_lib/_ccallback_c.pyx |
186 |
| -+++ b/scipy/_lib/_ccallback_c.pyx |
187 |
| -@@ -210,15 +210,15 @@ cdef double sine(double x, void *user_data) nogil except *: |
188 |
| - import ctypes |
189 |
| - |
190 |
| - plus1_t = ctypes.CFUNCTYPE(ctypes.c_double, ctypes.c_double, ctypes.POINTER(ctypes.c_int), ctypes.c_void_p) |
191 |
| --plus1_ctypes = ctypes.cast(<size_t>&plus1_cython, plus1_t) |
192 |
| -+# plus1_ctypes = ctypes.cast(<size_t>&plus1_cython, plus1_t) |
193 |
| - |
194 |
| - plus1b_t = ctypes.CFUNCTYPE(ctypes.c_double, ctypes.c_double, ctypes.c_double, |
195 |
| - ctypes.POINTER(ctypes.c_int), ctypes.c_void_p) |
196 |
| --plus1b_ctypes = ctypes.cast(<size_t>&plus1b_cython, plus1b_t) |
197 |
| -+# plus1b_ctypes = ctypes.cast(<size_t>&plus1b_cython, plus1b_t) |
198 |
| - |
199 |
| - plus1bc_t = ctypes.CFUNCTYPE(ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, |
200 |
| - ctypes.POINTER(ctypes.c_int), ctypes.c_void_p) |
201 |
| --plus1bc_ctypes = ctypes.cast(<size_t>&plus1bc_cython, plus1bc_t) |
202 |
| -+# plus1bc_ctypes = ctypes.cast(<size_t>&plus1bc_cython, plus1bc_t) |
203 |
| - |
204 |
| - sine_t = ctypes.CFUNCTYPE(ctypes.c_double, ctypes.c_double, ctypes.c_void_p) |
205 |
| --sine_ctypes = ctypes.cast(<size_t>&sine, sine_t) |
206 |
| -+# sine_ctypes = ctypes.cast(<size_t>&sine, sine_t) |
207 |
| -diff --git a/scipy/_lib/setup.py b/scipy/_lib/setup.py |
208 |
| -index 6fca8a66..95000399 100644 |
209 |
| ---- a/scipy/_lib/setup.py |
210 |
| -+++ b/scipy/_lib/setup.py |
211 |
| -@@ -55,8 +55,6 @@ def configuration(parent_package='',top_path=None): |
212 |
| - # Generate a header file containing defines |
213 |
| - config_cmd = config.get_config_cmd() |
214 |
| - defines = [] |
215 |
| -- if config_cmd.check_func('open_memstream', decl=True, call=True): |
216 |
| -- defines.append(('HAVE_OPEN_MEMSTREAM', '1')) |
217 |
| - target = os.path.join(os.path.dirname(__file__), 'src', |
218 |
| - 'messagestream_config.h') |
219 |
| - with open(target, 'w') as f: |
220 |
| -diff --git a/scipy/_lib/src/messagestream_config.h.in b/scipy/_lib/src/messagestream_config.h.in |
221 |
| -index fe2a3876..1cdf6c79 100644 |
222 |
| ---- a/scipy/_lib/src/messagestream_config.h.in |
223 |
| -+++ b/scipy/_lib/src/messagestream_config.h.in |
224 |
| -@@ -1 +1 @@ |
225 |
| --#define HAVE_OPEN_MEMSTREAM @has_openmemstream@ |
226 |
| -+#define HAVE_OPEN_MEMSTREAM 0 // @has_openmemstream@ |
227 |
| -\ No newline at end of file |
228 |
| -diff --git a/scipy/sparse/linalg/meson.build b/scipy/sparse/linalg/meson.build |
229 |
| -index 946cac0c..96852886 100644 |
230 |
| ---- a/scipy/sparse/linalg/meson.build |
231 |
| -+++ b/scipy/sparse/linalg/meson.build |
232 |
| -@@ -15,7 +15,7 @@ py3.install_sources([ |
233 |
| - subdir: 'scipy/sparse/linalg' |
234 |
| - ) |
235 |
| - |
236 |
| --subdir('_propack') |
237 |
| -+# subdir('_propack') |
238 |
| - subdir('_isolve') |
239 |
| - subdir('_dsolve') |
240 |
| - subdir('_eigen') |
241 |
| -diff --git a/scipy/special/meson.build b/scipy/special/meson.build |
242 |
| -index f92183f5..b1443aad 100644 |
243 |
| ---- a/scipy/special/meson.build |
244 |
| -+++ b/scipy/special/meson.build |
245 |
| -@@ -427,24 +427,24 @@ py3.extension_module('_test_internal', |
246 |
| - # Must use `custom_target`, because `py3.install_sources` does not work with |
247 |
| - # generated sources - see https://github.com/mesonbuild/meson/issues/7372 |
248 |
| - npz_files = [ |
249 |
| -- [ |
250 |
| -- '_data_boost', |
251 |
| -- 'tests/data/boost/assoc_legendre_p_ipp/assoc_legendre_p.txt', |
252 |
| -- 'boost', |
253 |
| -- 'boost.npz' |
254 |
| -- ], |
255 |
| -- [ |
256 |
| -- '_data_gsl', |
257 |
| -- 'tests/data/gsl/mathieu_ab.txt', |
258 |
| -- 'gsl', |
259 |
| -- 'gsl.npz' |
260 |
| -- ], |
261 |
| -- [ |
262 |
| -- '_data_local', |
263 |
| -- 'tests/data/local/ellipkm1.txt', |
264 |
| -- 'local', |
265 |
| -- 'local.npz' |
266 |
| -- ], |
267 |
| -+ # [ |
268 |
| -+ # '_data_boost', |
269 |
| -+ # 'tests/data/boost/assoc_legendre_p_ipp/assoc_legendre_p.txt', |
270 |
| -+ # 'boost', |
271 |
| -+ # 'boost.npz' |
272 |
| -+ # ], |
273 |
| -+ # [ |
274 |
| -+ # '_data_gsl', |
275 |
| -+ # 'tests/data/gsl/mathieu_ab.txt', |
276 |
| -+ # 'gsl', |
277 |
| -+ # 'gsl.npz' |
278 |
| -+ # ], |
279 |
| -+ # [ |
280 |
| -+ # '_data_local', |
281 |
| -+ # 'tests/data/local/ellipkm1.txt', |
282 |
| -+ # 'local', |
283 |
| -+ # 'local.npz' |
284 |
| -+ # ], |
285 |
| - ] |
286 |
| - |
287 |
| - foreach npz_file: npz_files |
288 |
| -diff --git a/tools/cythonize.py b/tools/cythonize.py |
289 |
| -index 402824cb..b6aba959 100755 |
290 |
| ---- a/tools/cythonize.py |
291 |
| -+++ b/tools/cythonize.py |
292 |
| -@@ -95,21 +95,19 @@ def process_pyx(fromfile, tofile, cwd): |
293 |
| - if tofile.endswith('.cxx'): |
294 |
| - flags += ['--cplus'] |
295 |
| - |
296 |
| -- try: |
297 |
| -+ try: |
298 |
| -+ from Cython.Compiler.Main import setuptools_main |
299 |
| -+ prev_argv = sys.argv[1:] |
300 |
| - try: |
301 |
| -- r = subprocess.call(['cython'] + flags + ["-o", tofile, fromfile], cwd=cwd) |
302 |
| -- if r != 0: |
303 |
| -- raise Exception('Cython failed') |
304 |
| -- except OSError as e: |
305 |
| -- # There are ways of installing Cython that don't result in a cython |
306 |
| -- # executable on the path, see gh-2397. |
307 |
| -- r = subprocess.call([sys.executable, '-c', |
308 |
| -- 'import sys; from Cython.Compiler.Main import ' |
309 |
| -- 'setuptools_main as main; sys.exit(main())'] + flags + |
310 |
| -- ["-o", tofile, fromfile], |
311 |
| -- cwd=cwd) |
312 |
| -- if r != 0: |
313 |
| -- raise Exception("Cython either isn't installed or it failed.") from e |
314 |
| -+ oldcwd = os.getcwd() |
315 |
| -+ os.chdir(cwd) |
316 |
| -+ sys.argv[1:] = flags + ["-o", tofile, fromfile] |
317 |
| -+ retcode = setuptools_main() |
318 |
| -+ if retcode: |
319 |
| -+ sys.exit(retcode) |
320 |
| -+ finally: |
321 |
| -+ sys.argv[1:] = prev_argv |
322 |
| -+ os.chdir(oldcwd) |
323 |
| - except OSError as e: |
324 |
| - raise OSError('Cython needs to be installed') from e |
325 |
| - |
326 |
| -@@ -253,7 +251,7 @@ def find_process_files(root_dir): |
327 |
| - lock = Lock() |
328 |
| - |
329 |
| - try: |
330 |
| -- num_proc = int(os.environ.get('SCIPY_NUM_CYTHONIZE_JOBS', cpu_count())) |
331 |
| -+ num_proc = int(os.environ.get('SCIPY_NUM_CYTHONIZE_JOBS', 1)) |
332 |
| - pool = Pool(processes=num_proc) |
333 |
| - except ImportError as e: |
334 |
| - # Allow building (single-threaded) on GNU/Hurd, which does not |
0 commit comments