Skip to content
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

Use CFLAGS if set as-is, match CXXFLAGS behavior #322

Merged
merged 2 commits into from
Dec 27, 2024
Merged
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
1 change: 1 addition & 0 deletions distutils/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ def customize_compiler(compiler):

ldshared = _add_flags(ldshared, 'LD')
ldcxxshared = _add_flags(ldcxxshared, 'LD')
cflags = os.environ.get('CFLAGS', cflags)
cflags = _add_flags(cflags, 'C')
Comment on lines +343 to 344
Copy link

Choose a reason for hiding this comment

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

Hi, I am a bit confused why you are keeping the _add_flags(cflags, 'C') line, CXX doesn't have it (should it?), and it seems redundant (probably duplicates those flags, although I didn't test)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, you're right, I'd left it in because I tried something else, and forgot to clean it up. I'll do that in a followup after testing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, submitted #325. Sorry for the oversight.

ldshared = _add_flags(ldshared, 'C')
cxxflags = os.environ.get('CXXFLAGS', cxxflags)
Expand Down
6 changes: 4 additions & 2 deletions distutils/tests/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ def test_customize_compiler(self):
comp = self.customize_compiler()
assert comp.exes['archiver'] == 'env_ar --env-arflags'
assert comp.exes['preprocessor'] == 'env_cpp --env-cppflags'
assert comp.exes['compiler'] == 'env_cc --sc-cflags --env-cflags --env-cppflags'
assert (
comp.exes['compiler'] == 'env_cc --env-cflags --env-cflags --env-cppflags'
)
assert comp.exes['compiler_so'] == (
'env_cc --sc-cflags --env-cflags --env-cppflags --sc-ccshared'
'env_cc --env-cflags --env-cflags --env-cppflags --sc-ccshared'
)
assert (
comp.exes['compiler_cxx']
Expand Down
Loading