Skip to content

[BUG] setuptools 75.7.0 and CFLAGS #4836

@stanislavlevin

Description

@stanislavlevin

setuptools version

75.7.0

Python version

3.12.8

OS

ALTLinux

Additional environment information

No response

Description

With pypa/distutils#299 (merged to setuptools 75.7.0) the CFLAGS behavior changed.
Docs are not updated to that change and describe the previous state.

https://setuptools.pypa.io/en/latest/userguide/ext_modules.html#compiler-and-linker-options

The compiler options appear in the command line in the following order:

  • first, the options provided by the sysconfig variable CFLAGS,
  • then, the options provided by the environment variables CFLAGS and CPPFLAGS,

This is the behavior used for RPM build for long time. CFLAGS was/is used to append additional distro-specific options to the CPython's ones.

After the aforementioned change CFLAGS env variable overrides sysconfigs CFLAGS and it's no longer possible to supply additional flags.

So it's a behavior change.

Expected behavior

There should be a way to pass additional flags for compilers according to documentation.

How to Reproduce

Try to build an extension with CFLAGS and without to see the difference in compiler flags.

Output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.bug
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions