Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/no-fortran.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: No Fortran compiler build

on:
pull_request:

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
no_fortran:
runs-on: macos-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive

- uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1
with:
pixi-version: v0.62.0
run-install: false

- name: Install test environment
run: pixi global install --with=pyyaml --environment=test python pytest

- name: Build and install SciPy
run: BUILD_EDITABLE_PYTHON=false pixi global install --environment=test --path .

- name: Show SciPy config
working-directory: tools
run: python -c 'import scipy; scipy.show_config()'

- name: Test `scipy.linalg`
working-directory: tools
run: |
python -c "
import scipy, pytest
from pathlib import Path
linalg = Path(scipy.linalg.__file__).parent
pytest.main(linalg)
"
39 changes: 2 additions & 37 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,7 @@ endif
if host_machine.system() == 'os400'
# IBM i system, needed to avoid build errors - see gh-17193
add_project_arguments('-D__STDC_FORMAT_MACROS', language : 'cpp')
add_project_link_arguments('-Wl,-bnotextro', language : ['c', 'cpp', 'fortran'])
endif

# Adding at project level causes many spurious -lgfortran flags.
add_languages('fortran', native: false)
ff = meson.get_compiler('fortran')
if ff.get_id() == 'gcc'
# -std=legacy is not supported by all Fortran compilers, but very useful with
# gfortran since it avoids a ton of warnings that we don't care about.
# Needs fixing in Meson, see https://github.com/mesonbuild/meson/issues/11633.
add_project_arguments('-std=legacy', language: 'fortran')
endif

if ff.has_argument('-Wno-conversion')
add_project_arguments('-Wno-conversion', language: 'fortran')
endif

if ff.get_id() == 'llvm-flang'
add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: ['fortran'])
# -Wall warnings are visible because Meson's warning_level defaults to 1 (-Wall)
# LLVM tracking issue: https://github.com/llvm/llvm-project/issues/89888
add_project_link_arguments('-Wl,-bnotextro', language : ['c', 'cpp'])
endif

if cc.get_id() == 'clang-cl'
Expand All @@ -118,7 +98,7 @@ endif
if host_machine.system() == 'darwin'
if cc.has_link_argument('-Wl,-dead_strip')
# Allow linker to strip unused symbols
add_project_link_arguments('-Wl,-dead_strip', language : ['c', 'cpp', 'fortran'])
add_project_link_arguments('-Wl,-dead_strip', language : ['c', 'cpp'])
endif
endif

Expand All @@ -142,22 +122,7 @@ if cc.get_id() in ['intel', 'intel-llvm']
elif cc.get_id() in ['intel-cl', 'intel-llvm-cl']
_intel_cflags += cc.get_supported_arguments('/fp:strict')
endif
if ff.get_id() in ['intel', 'intel-llvm']
_intel_fflags = ff.get_supported_arguments('-fp-model=strict')
minus0_arg = ['-assume', 'minus0']
if ff.has_multi_arguments(minus0_arg)
_intel_fflags += minus0_arg
endif
elif ff.get_id() in ['intel-cl', 'intel-llvm-cl']
# Intel Fortran on Windows does things differently, so deal with that
# (also specify dynamic linking and the right name mangling)
_intel_fflags = ff.get_supported_arguments(
'/fp:strict', '/MD', '/names:lowercase', '/assume:underscore',
'/assume:minus0'
)
endif
add_global_arguments(_intel_cflags, language: ['c', 'cpp'])
add_global_arguments(_intel_fflags, language: 'fortran')

# Hide symbols when building on Linux with GCC. For Python extension modules,
# we only need `PyInit_*` to be public, anything else may cause problems. So we
Expand Down
31 changes: 30 additions & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,37 @@ name = "scipy"
description = "Fundamental algorithms for scientific computing in Python."
authors = ["SciPy Developers <scipy-dev@python.org>"]
channels = ["https://prefix.dev/conda-forge"]
platforms = ["linux-64", "osx-arm64", "win-64"]
# platforms = ["linux-64", "osx-arm64", "win-64"]
platforms = ["osx-arm64"]
preview = ["pixi-build"]

[package]
license = "BSD-3-Clause"

[package.build.backend]
name = "pixi-build-python"
version = "*"

[package.build.config]
compilers = ["c", "cxx"]
env.CXXFLAGS = "${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"

[package.host-dependencies]
python = "*"
meson = "*"
meson-python = "*"
pkg-config = "*"
ninja = "*"
cmake = "*"
numpy = "*"
cython = "*"
pythran = "*"
openblas = "*"
pybind11 = "*"
uv = "*"

[package.run-dependencies]
numpy = "*"

### Environments ###
# We include one build task (and a corresponding environment) per solve group
Expand Down
6 changes: 3 additions & 3 deletions scipy/linalg/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ linalg_cython_gen = generator(cython,

# fblas
fblas_module = custom_target('fblas_module',
output: ['_fblasmodule.c', '_fblas-f2pywrappers.f'],
output: ['_fblasmodule.c'],
input: 'fblas.pyf.src',
command: [generate_f2pymod, '@INPUT@', '-o', '@OUTDIR@'] + f2py_freethreading_arg,
depend_files:
Expand Down Expand Up @@ -116,7 +116,7 @@ py3.extension_module('_flapack',
# in azure-pipelines.yml if you want to check that).
if use_ilp64
fblas64_module = custom_target('fblas64_module',
output: ['_fblas_64module.c', '_fblas_64-f2pywrappers.f'],
output: ['_fblas_64module.c'],
input: 'fblas_64.pyf.src',
command: [generate_f2pymod, '@INPUT@', '-o', '@OUTDIR@'] + f2py_ilp64_opts + f2py_freethreading_arg,
depend_files:
Expand All @@ -138,7 +138,7 @@ if use_ilp64
)

flapack64_module = custom_target('flapack64_module',
output: ['_flapack_64module.c', '_flapack_64-f2pywrappers.f'],
output: ['_flapack_64module.c'],
input: 'flapack_64.pyf.src',
command: [generate_f2pymod, '@INPUT@', '-o', '@OUTDIR@'] + f2py_ilp64_opts + f2py_freethreading_arg,
)
Expand Down
48 changes: 0 additions & 48 deletions scipy/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ fs = import('fs')

# Platform detection
is_mingw = is_windows and cc.get_id() == 'gcc'
if is_mingw and ff.get_id() != 'gcc'
error('If you are using GCC on Windows, you must also use GFortran! Detected ' + ff.get_id())
endif

cython_c_args = ['-DCYTHON_CCOMPLEX=0'] # see gh-18975 for why we need this
if is_mingw
Expand Down Expand Up @@ -597,51 +594,8 @@ cpp_args_pythran += [
_cpp_Wno_int_in_bool_context,
]

# Fortran warning flags
_fflag_Wno_argument_mismatch = ff.get_supported_arguments('-Wno-argument-mismatch')
_fflag_Wno_conversion = ff.get_supported_arguments('-Wno-conversion')
_fflag_Wno_intrinsic_shadow = ff.get_supported_arguments('-Wno-intrinsic-shadow')
_fflag_Wno_maybe_uninitialized = ff.get_supported_arguments('-Wno-maybe-uninitialized')
_fflag_Wno_surprising = ff.get_supported_arguments('-Wno-surprising')
_fflag_Wno_uninitialized = ff.get_supported_arguments('-Wno-uninitialized')
_fflag_Wno_unused_dummy_argument = ff.get_supported_arguments('-Wno-unused-dummy-argument')
_fflag_Wno_unused_label = ff.get_supported_arguments('-Wno-unused-label')
_fflag_Wno_unused_variable = ff.get_supported_arguments('-Wno-unused-variable')
_fflag_Wno_tabs = ff.get_supported_arguments('-Wno-tabs')
# The default list of warnings to ignore from Fortran code. There is a lot of
# old, vendored code that is very bad and we want to compile it silently (at
# least with GCC and Clang)
fortran_ignore_warnings = ff.get_supported_arguments(
_fflag_Wno_argument_mismatch,
_fflag_Wno_conversion,
_fflag_Wno_maybe_uninitialized,
_fflag_Wno_unused_dummy_argument,
_fflag_Wno_unused_label,
_fflag_Wno_unused_variable,
_fflag_Wno_tabs,
)

# Intel Fortran (ifort) does not run the preprocessor by default, if Fortran
# code uses preprocessor statements, add this compile flag to it.

# Gfortran does run the preprocessor for .F files, and PROPACK is the only
# component which needs the preprocessor (unless we need symbol renaming for
# blas_symbol_suffix).
_fflag_preprocess = []
_gfortran_preprocess = ['-cpp', '-ffree-line-length-none', '-ffixed-line-length-none']
if ff.has_multi_arguments(_gfortran_preprocess)
_fflag_preprocess = _gfortran_preprocess
else
_fflag_preprocess = ff.first_supported_argument(['-fpp', '/fpp', '-cpp'])
endif

_fflag_ilp64 = []
f2py_ilp64_opts = []
if use_ilp64
# Gfortran and Clang use `-fdefault-integer-8` to switch to 64-bit integers by
# default, all other known compilers use `-i8`
_fflag_ilp64 = ff.first_supported_argument(['-fdefault-integer-8', '-i8'])

# Write out a mapping file for f2py for defaulting to ILP64
conf_data = configuration_data()
if cc.sizeof('long') == 8
Expand Down Expand Up @@ -715,7 +669,6 @@ compilers = {
'C': cc,
'CPP': cpp,
'CYTHON': meson.get_compiler('cython'),
'FORTRAN': meson.get_compiler('fortran')
}

machines = {
Expand Down Expand Up @@ -845,6 +798,5 @@ subdir('differentiate')
subdir('signal')
subdir('interpolate')
subdir('ndimage')
subdir('odr')
subdir('datasets')
subdir('misc')
Loading
Loading