Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: Handle --f77flags and --f90flags for meson [wheel build] #26870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

charris
Copy link
Member

@charris charris commented Jul 5, 2024

Backport of #26703, #26706, and #26812.

Closes #25784. Background and notes:

  • Although the CLI was passing fc_flags to the Meson backend they weren't being used
  • The behavior currently is to (redundantly) collect the unique set of flags passed via either --f77flags or --f90flags
    • They all map to fortran_args for the meson.build (distutils used to have separate handling for the two cases)
    • Eventually these should be merged into a single --fflags argument (basically since they're now redundant post-distutils)
      • This is likely only when we have 3.12 as the lowest supported version, since distutils will need to have both CLI options
  • The test is specially crafted to get an error without -ffixed-form but is otherwise junk
    • Adding a continuation character at the end of the line as well will both get f2py and gfortran to compile without -ffixed-form
    • Or putting the same code in a .f file, thereby signalling to F2PY that this is a Fortran 77 file

It does make sense to handle fortran_args this way though, since it is more robust than setting FFLAGS (which anyway won't work due to a meson bug, mesonbuild/meson#13327).

Squashed commit of the following:

commit bbc198b48b79417f210bd38de6c60ab98d18857d
Author: Rohit Goswami [email protected]
Date: Fri Jun 28 19:43:41 2024 +0200

CI,MAINT: Bump gfortran version [wheel build]

Co-authored-by: ngoldbaum <[email protected]>

commit fffa296b7a611de1ab25f85619e92e6d6c5185a4
Author: Rohit Goswami [email protected]
Date: Fri Jun 28 14:54:50 2024 +0200

CI,TST: Fix meson tests needing gfortran [wheel build]

commit 807e898e80e544e720512f9feccc9c897cd55f08
Author: Rohit Goswami [email protected]
Date: Sun Jun 16 09:40:06 2024 +0000

TST: Skip an f2py module test on Windows

commit cbcb6c2c4340f5bbca46e2c6d8474bbed7d90664
Author: Rohit Goswami [email protected]
Date: Sun Jun 16 04:06:16 2024 +0000

MAINT: Be more robust wrt f2py flags

commit 09e3eb004b0e076271817384a92d489b3b0cc0eb
Author: Rohit Goswami [email protected]
Date: Sun Jun 16 03:44:17 2024 +0000

TST: Add one for passing arguments to f2py

Co-authored-by: warrickball <[email protected]>

commit 04d53b44b75537fc5b411cf9e54c2f169198419f
Author: Rohit Goswami [email protected]
Date: Sun Jun 16 00:14:54 2024 +0000

BUG: Use fortran args from f2py in meson

commit 6f736b0cbe977ba9270c45f7cc22b7ae8ce06ed2
Author: Rohit Goswami [email protected]
Date: Sat Jun 15 23:36:55 2024 +0000

MAINT,BUG: Correctly skip distutils options

Backport of numpy#26703, numpy#26706, and numpy#26812.

Closes numpy#25784. Background and notes:
- Although the CLI was passing `fc_flags` to the Meson backend they
  weren't being used
- The behavior currently is to (redundantly) collect the unique set of
  flags passed via either `--f77flags` or `--f90flags`
  - They all map to `fortran_args` for the `meson.build` (`distutils`
    used to have separate handling for the two cases)
  - Eventually these should be merged into a single `--fflags` argument
    (basically since they're now redundant post-distutils)
    - This is likely only when we have 3.12 as the lowest supported
      version, since `distutils` will need to have both CLI options
- The test is specially crafted to get an error without `-ffixed-form`
  but is otherwise junk
  - Adding a continuation character at the end of the line as well will
    both get `f2py` and `gfortran` to compile without `-ffixed-form`
  - Or putting the same code in a `.f` file, thereby signalling to F2PY
    that this is a Fortran 77 file

It does make sense to handle `fortran_args` this way though, since it is
more robust than setting `FFLAGS` (which anyway won't work due to a
`meson` bug, mesonbuild/meson#13327).

Squashed commit of the following:

commit bbc198b48b79417f210bd38de6c60ab98d18857d
Author: Rohit Goswami <[email protected]>
Date:   Fri Jun 28 19:43:41 2024 +0200

    CI,MAINT: Bump gfortran version [wheel build]

    Co-authored-by: ngoldbaum <[email protected]>

commit fffa296b7a611de1ab25f85619e92e6d6c5185a4
Author: Rohit Goswami <[email protected]>
Date:   Fri Jun 28 14:54:50 2024 +0200

    CI,TST: Fix meson tests needing gfortran [wheel build]

commit 807e898e80e544e720512f9feccc9c897cd55f08
Author: Rohit Goswami <[email protected]>
Date:   Sun Jun 16 09:40:06 2024 +0000

    TST: Skip an f2py module test on Windows

commit cbcb6c2c4340f5bbca46e2c6d8474bbed7d90664
Author: Rohit Goswami <[email protected]>
Date:   Sun Jun 16 04:06:16 2024 +0000

    MAINT: Be more robust wrt f2py flags

commit 09e3eb004b0e076271817384a92d489b3b0cc0eb
Author: Rohit Goswami <[email protected]>
Date:   Sun Jun 16 03:44:17 2024 +0000

    TST: Add one for passing arguments to f2py

    Co-authored-by: warrickball <[email protected]>

commit 04d53b44b75537fc5b411cf9e54c2f169198419f
Author: Rohit Goswami <[email protected]>
Date:   Sun Jun 16 00:14:54 2024 +0000

    BUG: Use fortran args from f2py in meson

commit 6f736b0cbe977ba9270c45f7cc22b7ae8ce06ed2
Author: Rohit Goswami <[email protected]>
Date:   Sat Jun 15 23:36:55 2024 +0000

    MAINT,BUG: Correctly skip distutils options
@charris charris added this to the 2.0.1 release milestone Jul 5, 2024
@charris charris merged commit 9eefede into numpy:maintenance/2.0.x Jul 5, 2024
85 of 89 checks passed
@charris charris deleted the backport-26703-26706-26812 branch July 5, 2024 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant