@@ -166,98 +166,98 @@ def run(self):
166
166
setup_requires = []
167
167
default_backend = None
168
168
169
- # Go through all of the packages and figure out which ones we are
170
- # going to build/install.
171
- print_line ()
172
- print_raw ("Edit setup.cfg to change the build options" )
173
-
174
- required_failed = []
175
- good_packages = []
176
- for package in mpl_packages :
177
- if isinstance (package , str ):
178
- print_raw ('' )
179
- print_raw (package .upper ())
180
- else :
181
- try :
182
- result = package .check ()
183
- if result is not None :
184
- message = 'yes [%s]' % result
185
- print_status (package .name , message )
186
- except setupext .CheckFailed as e :
187
- msg = str (e ).strip ()
188
- if len (msg ):
189
- print_status (package .name , 'no [%s]' % msg )
190
- else :
191
- print_status (package .name , 'no' )
192
- if not package .optional :
193
- required_failed .append (package )
194
- else :
195
- good_packages .append (package )
196
- if (isinstance (package , setupext .OptionalBackendPackage ) and
197
- package .runtime_check () and
198
- default_backend is None ):
199
- default_backend = package .name
200
- print_raw ('' )
201
-
202
- # Abort if any of the required packages can not be built.
203
- if required_failed :
169
+ # If the user just queries for information, don't bother figuring out which
170
+ # packages to build or install.
171
+ if (any ('--' + opt in sys .argv for opt in
172
+ Distribution .display_option_names + ['help' ]) or
173
+ 'clean' in sys .argv ):
174
+ setup_requires = []
175
+ else :
176
+ # Go through all of the packages and figure out which ones we are
177
+ # going to build/install.
204
178
print_line ()
205
- message = ("The following required packages can not "
206
- "be built: %s" %
207
- ", " .join (x .name for x in required_failed ))
208
- for pkg in required_failed :
209
- pkg_help = pkg .install_help_msg ()
210
- if pkg_help :
211
- message += "\n * " + pkg_help
212
- print_message (message )
213
- sys .exit (1 )
214
-
215
- # Now collect all of the information we need to build all of the
216
- # packages.
217
- for package in good_packages :
218
- packages .extend (package .get_packages ())
219
- namespace_packages .extend (package .get_namespace_packages ())
220
- py_modules .extend (package .get_py_modules ())
221
- ext = package .get_extension ()
222
- if ext is not None :
223
- ext_modules .append (ext )
224
- data = package .get_package_data ()
225
- for key , val in data .items ():
226
- package_data .setdefault (key , [])
227
- package_data [key ] = list (set (val + package_data [key ]))
228
- install_requires .extend (package .get_install_requires ())
229
- setup_requires .extend (package .get_setup_requires ())
230
-
231
- # Write the default matplotlibrc file
232
- if default_backend is None :
233
- default_backend = 'svg'
234
- if setupext .options ['backend' ]:
235
- default_backend = setupext .options ['backend' ]
236
- with open ('matplotlibrc.template' ) as fd :
237
- template = fd .read ()
238
- template = Template (template )
239
- with open ('lib/matplotlib/mpl-data/matplotlibrc' , 'w' ) as fd :
240
- fd .write (template .safe_substitute (TEMPLATE_BACKEND = default_backend ))
241
-
242
- # Build in verbose mode if requested
243
- if setupext .options ['verbose' ]:
179
+ print_raw ("Edit setup.cfg to change the build options" )
180
+
181
+ required_failed = []
182
+ good_packages = []
183
+ for package in mpl_packages :
184
+ if isinstance (package , str ):
185
+ print_raw ('' )
186
+ print_raw (package .upper ())
187
+ else :
188
+ try :
189
+ result = package .check ()
190
+ if result is not None :
191
+ message = 'yes [%s]' % result
192
+ print_status (package .name , message )
193
+ except setupext .CheckFailed as e :
194
+ msg = str (e ).strip ()
195
+ if len (msg ):
196
+ print_status (package .name , 'no [%s]' % msg )
197
+ else :
198
+ print_status (package .name , 'no' )
199
+ if not package .optional :
200
+ required_failed .append (package )
201
+ else :
202
+ good_packages .append (package )
203
+ if (isinstance (package , setupext .OptionalBackendPackage ) and
204
+ package .runtime_check () and
205
+ default_backend is None ):
206
+ default_backend = package .name
207
+ print_raw ('' )
208
+
209
+ # Abort if any of the required packages can not be built.
210
+ if required_failed :
211
+ print_line ()
212
+ message = ("The following required packages can not "
213
+ "be built: %s" %
214
+ ", " .join (x .name for x in required_failed ))
215
+ for pkg in required_failed :
216
+ pkg_help = pkg .install_help_msg ()
217
+ if pkg_help :
218
+ message += "\n * " + pkg_help
219
+ print_message (message )
220
+ sys .exit (1 )
221
+
222
+ # Now collect all of the information we need to build all of the
223
+ # packages.
224
+ for package in good_packages :
225
+ packages .extend (package .get_packages ())
226
+ namespace_packages .extend (package .get_namespace_packages ())
227
+ py_modules .extend (package .get_py_modules ())
228
+ ext = package .get_extension ()
229
+ if ext is not None :
230
+ ext_modules .append (ext )
231
+ data = package .get_package_data ()
232
+ for key , val in data .items ():
233
+ package_data .setdefault (key , [])
234
+ package_data [key ] = list (set (val + package_data [key ]))
235
+ install_requires .extend (package .get_install_requires ())
236
+ setup_requires .extend (package .get_setup_requires ())
237
+
238
+ # Write the default matplotlibrc file
239
+ if default_backend is None :
240
+ default_backend = 'svg'
241
+ if setupext .options ['backend' ]:
242
+ default_backend = setupext .options ['backend' ]
243
+ with open ('matplotlibrc.template' ) as fd :
244
+ template = fd .read ()
245
+ template = Template (template )
246
+ with open ('lib/matplotlib/mpl-data/matplotlibrc' , 'w' ) as fd :
247
+ fd .write (template .safe_substitute (TEMPLATE_BACKEND = default_backend ))
248
+
249
+ # Build in verbose mode if requested
250
+ if setupext .options ['verbose' ]:
251
+ for mod in ext_modules :
252
+ mod .extra_compile_args .append ('-DVERBOSE' )
253
+
254
+ # Finalize the extension modules so they can get the Numpy include
255
+ # dirs
244
256
for mod in ext_modules :
245
- mod .extra_compile_args .append ('-DVERBOSE' )
246
-
247
- # Finalize the extension modules so they can get the Numpy include
248
- # dirs
249
- for mod in ext_modules :
250
- mod .finalize ()
257
+ mod .finalize ()
251
258
252
259
extra_args = {}
253
260
254
- # Avoid installing setup_requires dependencies if the user just
255
- # queries for information
256
- if (any ('--' + opt in sys .argv for opt in
257
- Distribution .display_option_names + ['help' ]) or
258
- 'clean' in sys .argv ):
259
- setup_requires = []
260
-
261
261
# Finally, pass this all along to distutils to do the heavy lifting.
262
262
distrib = setup (
263
263
name = "matplotlib" ,
0 commit comments