Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfae8a09

Browse files
committed
Reduce redundancy while checking *FLAGS for LTO.
1 parent559044e commitfae8a09

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

‎setup.py

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -111,31 +111,27 @@ def add_optimization_flags(self):
111111
enable_lto=setupext.config.getboolean('libs','enable_lto',
112112
fallback=None)
113113

114-
if'CFLAGS'inos.environ:
115-
if'-fno-lto'inos.environ['CFLAGS']:
116-
ifenable_ltoisTrue:
117-
raiseValueError('Configuration enable_lto=True, but '
118-
'CFLAGS contains -fno-lto')
119-
enable_lto=False
120-
cppflags= []
121-
if'CPPFLAGS'inos.environ:
122-
cppflags.append(os.environ['CPPFLAGS'])
123-
if'-fno-lto'inos.environ['CPPFLAGS']:
124-
ifenable_ltoisTrue:
125-
raiseValueError('Configuration enable_lto=True, but '
126-
'CPPFLAGS contains -fno-lto')
127-
enable_lto=False
128-
cxxflags= []
129-
if'CXXFLAGS'inos.environ:
130-
cxxflags.append(os.environ['CXXFLAGS'])
131-
if'-fno-lto'inos.environ['CXXFLAGS']:
132-
ifenable_ltoisTrue:
133-
raiseValueError('Configuration enable_lto=True, but '
134-
'CXXFLAGS contains -fno-lto')
135-
enable_lto=False
136-
ldflags= []
137-
if'LDFLAGS'inos.environ:
138-
ldflags.append(os.environ['LDFLAGS'])
114+
defprepare_flags(name,enable_lto):
115+
"""
116+
Prepare *FLAGS from the environment.
117+
118+
If set, return them, and also check whether LTO is disabled in each
119+
one, raising an error if Matplotlib config explicitly enabled LTO.
120+
"""
121+
flags= []
122+
ifnameinos.environ:
123+
flags.append(os.environ[name])
124+
if'-fno-lto'inos.environ[name]:
125+
ifenable_ltoisTrue:
126+
raiseValueError('Configuration enable_lto=True, but '
127+
'{0} contains -fno-lto'.format(name))
128+
enable_lto=False
129+
returnflags,enable_lto
130+
131+
_,enable_lto=prepare_flags('CFLAGS',enable_lto)# Only check lto.
132+
cppflags,enable_lto=prepare_flags('CPPFLAGS',enable_lto)
133+
cxxflags,enable_lto=prepare_flags('CXXFLAGS',enable_lto)
134+
ldflags,enable_lto=prepare_flags('LDFLAGS',enable_lto)
139135

140136
ifenable_ltoisFalse:
141137
returnenv

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp