F2PY: add support for setuptools >= 74.0.0

Summary

F2PY no longer works with setuptools >= 74.0, from which distutils has been removed.

Environment

  • Operating System: Windows/Linux/MacOS
  • TELEMAC version: all

Steps to reproduce

compile_telemac.py

What is the current bug behaviour?

F2PY crashes during its second step when generating the API Python extension module.

What is the expected correct behaviour?

It shouldn't crash.

Relevant logs and/or screenshots

utils.exceptions.TelemacException: Error during the second part of F2PY: 1
Traceback (most recent call last):
  File "/home/d60881/.local/bin/f2py", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/d60881/.local/lib/python3.11/site-packages/numpy/f2py/f2py2e.py", line 766, in main
    run_compile()
  File "/home/d60881/.local/lib/python3.11/site-packages/numpy/f2py/f2py2e.py", line 594, in run_compile
    build_backend = f2py_build_generator(backend_key)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/d60881/.local/lib/python3.11/site-packages/numpy/f2py/_backends/__init__.py", line 6, in f2py_build_generator
    from ._distutils import DistutilsBackend
  File "/home/d60881/.local/lib/python3.11/site-packages/numpy/f2py/_backends/_distutils.py", line 3, in <module>
    from numpy.distutils.core import setup, Extension
  File "/home/d60881/.local/lib/python3.11/site-packages/numpy/distutils/core.py", line 24, in <module>
    from numpy.distutils.command import config, config_compiler, \
  File "/home/d60881/.local/lib/python3.11/site-packages/numpy/distutils/command/config.py", line 19, in <module>
    from numpy.distutils.mingw32ccompiler import generate_manifest
  File "/home/d60881/.local/lib/python3.11/site-packages/numpy/distutils/mingw32ccompiler.py", line 27, in <module>
    from distutils.msvccompiler import get_build_version as get_build_msvc_version
ModuleNotFoundError: No module named 'distutils.msvccompiler'

Possible fixes

Use Meson in this case, as with Python 3.12.