Skip to content

Fix cython_args build option handling - #16003

Open
cyphercodes wants to merge 2 commits into
mesonbuild:masterfrom
cyphercodes:fix-cython-args-option-15989
Open

Fix cython_args build option handling#16003
cyphercodes wants to merge 2 commits into
mesonbuild:masterfrom
cyphercodes:fix-cython-args-option-15989

Conversation

@cyphercodes

Copy link
Copy Markdown

Fixes #15989.

Summary

  • Add configured cython_args (-Dcython_args=... / machine-file built-in option) to Cython transpile commands.
  • Extend the existing Cython args test with a module that only builds when cython_args from build options is passed through.

Tests

  • python run_project_tests.py --use-tmpdir --only 'cython/3 cython_args' --failfast -v — passed (1 passed, 0 failed, 0 skipped)
  • python run_project_tests.py --use-tmpdir --only cython --failfast — passed (6 passed, 0 failed, 0 skipped)
  • Manual setup/build/test of test cases/cython/3 cython_args with -Dcython_args='--compile-time-env BUILTIN_VALUE=1' — passed; build.ninja contains the expected --compile-time-env BUILTIN_VALUE=1 Cython args.

@cyphercodes
cyphercodes requested a review from jpakkane as a code owner July 13, 2026 15:42
Comment thread mesonbuild/backend/ninjabackend.py Outdated
args += cython.get_option_std_args(target, target.subproject)
args += self.build.get_global_args(cython, target.for_machine)
args += self.build.get_project_args(cython, target)
args += self.environment.coredata.get_external_args(target.for_machine, cython.get_language())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're in the process of deleting get_external_args, instead use:

cy_args = self.environment.coredata.optstore.get_value_for(OptionKey('cython_args', target.subproject, target.for_machine)
assert isinstance(cy_args, list), 'for mypy
args += cy_args

I might have subproject and for_machine swapped

@dcbaker dcbaker added this to the 1.13 milestone Jul 13, 2026
@cyphercodes

Copy link
Copy Markdown
Author

Addressed the review request by reading cython_args from coredata.optstore with the target subproject/machine instead of get_external_args.

Verification:

  • git diff --check
  • python meson.py setup /tmp/meson-cython-args 'test cases/cython/3 cython_args' -Dcython_args='--compile-time-env BUILTIN_VALUE=1'
  • ninja -C /tmp/meson-cython-args test

Note: python run_project_tests.py --only 'cython/3 cython_args' did not run the cython suite in this container because the harness skipped cython compiler detection, so I verified the touched test case directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cython_args option has no effect

2 participants