Skip to content

Commit c97a3db

Browse files
authored
Merge pull request pypa/distutils#322 from thesamesam/cflags
Use CFLAGS if set as-is, match CXXFLAGS behavior
2 parents a8eec20 + 630551a commit c97a3db

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

distutils/sysconfig.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ def customize_compiler(compiler):
340340

341341
ldshared = _add_flags(ldshared, 'LD')
342342
ldcxxshared = _add_flags(ldcxxshared, 'LD')
343+
cflags = os.environ.get('CFLAGS', cflags)
343344
cflags = _add_flags(cflags, 'C')
344345
ldshared = _add_flags(ldshared, 'C')
345346
cxxflags = os.environ.get('CXXFLAGS', cxxflags)

distutils/tests/test_sysconfig.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,11 @@ def test_customize_compiler(self):
130130
comp = self.customize_compiler()
131131
assert comp.exes['archiver'] == 'env_ar --env-arflags'
132132
assert comp.exes['preprocessor'] == 'env_cpp --env-cppflags'
133-
assert comp.exes['compiler'] == 'env_cc --sc-cflags --env-cflags --env-cppflags'
133+
assert (
134+
comp.exes['compiler'] == 'env_cc --env-cflags --env-cflags --env-cppflags'
135+
)
134136
assert comp.exes['compiler_so'] == (
135-
'env_cc --sc-cflags --env-cflags --env-cppflags --sc-ccshared'
137+
'env_cc --env-cflags --env-cflags --env-cppflags --sc-ccshared'
136138
)
137139
assert (
138140
comp.exes['compiler_cxx']

0 commit comments

Comments
 (0)