@@ -137,12 +137,12 @@ include_dirs = [numpy_include, 'include', '.']
137
137
## Extensions using Fortran codes
138
138
139
139
# Relevant files for building MA27 extension.
140
- ma27_src = ['fd05ad .f' , 'ma27ad .f' ]
140
+ ma27_src = ['ma27s .f' , 'ma27d .f' ]
141
141
libma27_src = ['ma27fact.f' ]
142
142
pyma27_src = ['ma27_lib.c' , 'hsl_alloc.c' , '_pyma27.c' ]
143
143
144
144
# Build PyMA27
145
- ma27_sources = [os .path .join (hsl_rootdir , name ) for name in ma27_src ]
145
+ ma27_sources = [os .path .join (hsl_rootdir , 'ma27' , 'src' , name ) for name in ma27_src ]
146
146
ma27_sources += [os .path .join ('hsl' , 'solvers' , 'src' , name ) for name in libma27_src ]
147
147
pyma27_sources = [os .path .join ('hsl' , 'solvers' , 'src' , name ) for name in pyma27_src ]
148
148
@@ -158,12 +158,14 @@ if files_exist(ma27_sources):
158
158
include_dirs = ['include' , os .path .join ('hsl' ,'solvers' ,'src' )],)
159
159
160
160
# Build PyMA57
161
- ma57_src = ['ddeps.f' , 'ma57d.f' ]
162
- ma57_sources = [os .path .join (hsl_rootdir , 'ma57d ' , name ) for name in ma57_src ]
161
+ ma57_src = ['ddeps.f' , 'ma57d.f' , 'sdeps.f' , 'ma57s.f' ]
162
+ ma57_sources = [os .path .join (hsl_rootdir , 'ma57' , 'src ' , name ) for name in ma57_src ]
163
163
pyma57_src = ['ma57_lib.c' , 'hsl_alloc.c' , '_pyma57.c' ]
164
164
pyma57_sources = [os .path .join ('hsl' ,'solvers' ,'src' ,name ) for name in pyma57_src ]
165
165
166
166
if files_exist (ma57_sources ):
167
+ if not metis_lib :
168
+ ma57_src += ['fakemetis.f' ]
167
169
config .add_library (name = 'hsl_ma57' ,
168
170
sources = ma57_sources ,
169
171
libraries = [metis_lib ],
@@ -176,34 +178,39 @@ if files_exist(ma57_sources):
176
178
library_dirs = [metis_dir ],
177
179
include_dirs = ['include' ,os .path .join ('hsl' ,'solvers' ,'src' )],)
178
180
179
- mc29_sources = [os .path .join (hsl_rootdir , 'mc29d' , 'mc29d.f' ),
180
- os .path .join ('hsl' , 'scaling' , 'src' , 'mc29.pyf' )]
181
+ mc29_src = ['mc29d.f' , 'mc29s.f' ]
182
+ mc29_sources = [os .path .join (hsl_rootdir , 'mc29' , 'src' , name ) for name in mc29_src ]
183
+ mc29_sources += [os .path .join ('hsl' , 'scaling' , 'src' , 'mc29.pyf' )]
181
184
182
- config .add_extension (
183
- name = 'scaling._mc29' ,
184
- sources = mc29_sources ,
185
- include_dirs = [os .path .join ('hsl' , 'scaling' , 'src' )],
186
- extra_link_args = [])
185
+ if files_exist (mc29_sources ):
186
+ config .add_extension (
187
+ name = 'scaling._mc29' ,
188
+ sources = mc29_sources ,
189
+ include_dirs = [os .path .join ('hsl' , 'scaling' , 'src' )],
190
+ extra_link_args = [])
187
191
192
+ mc21_src = ['mc21d.f' , 'mc21s.f' ]
193
+ mc21_sources = [os .path .join (hsl_rootdir , 'mc21' , 'src' , name ) for name in mc21_src ]
194
+ mc21_sources += [os .path .join ('hsl' , 'ordering' , 'src' , 'mc21.pyf' )]
188
195
189
- mc21_sources = [os .path .join (hsl_rootdir , 'mc21d' , 'mc21d.f' ),
190
- os .path .join ('hsl' , 'ordering' , 'src' , 'mc21.pyf' )]
196
+ if files_exist (mc21_sources ):
197
+ config .add_extension (
198
+ name = 'ordering._mc21' ,
199
+ sources = mc21_sources ,
200
+ include_dirs = [os .path .join ('hsl' , 'ordering' , 'src' )],
201
+ extra_link_args = [])
191
202
192
- config .add_extension (
193
- name = 'ordering._mc21' ,
194
- sources = mc21_sources ,
195
- include_dirs = [os .path .join ('hsl' , 'ordering' , 'src' )],
196
- extra_link_args = [])
197
203
204
+ mc60_src = ['mc60d.f' , 'mc60s.f' ]
205
+ mc60_sources = [os .path .join (hsl_rootdir , 'mc60' , 'src' , name ) for name in mc60_src ]
206
+ mc60_sources += [os .path .join ('hsl' , 'ordering' , 'src' , 'mc60.pyf' )]
198
207
199
- mc60_sources = [os .path .join (hsl_rootdir , 'mc60d' , 'mc60d.f' ),
200
- os .path .join ('hsl' , 'ordering' , 'src' , 'mc60.pyf' )]
201
-
202
- config .add_extension (
203
- name = 'ordering._mc60' ,
204
- sources = mc60_sources ,
205
- include_dirs = [os .path .join ('hsl' , 'ordering' , 'src' )],
206
- extra_link_args = [])
208
+ if files_exist (mc60_sources ):
209
+ config .add_extension (
210
+ name = 'ordering._mc60' ,
211
+ sources = mc60_sources ,
212
+ include_dirs = [os .path .join ('hsl' , 'ordering' , 'src' )],
213
+ extra_link_args = [])
207
214
208
215
## Extensions using Cython
209
216
ext_params = {}
@@ -218,92 +225,95 @@ else:
218
225
context_ext_params = copy .deepcopy (ext_params )
219
226
{% for index_type in index_list % }
220
227
{% for element_type in type_list % }
221
- cyma27_src_ @ index_type @ _ @ element_type @ = [ 'ma27_lib.c' ,
222
- 'hsl_alloc .c' ,
223
- '_cyma27_base_@index_type@_@element_type@ .c']
224
- cyma27_sources_ @ index_type @ _ @ element_type @ = [ os . path . join ( 'hsl' , 'solvers' , 'src' , name ) for name in cyma27_src_ @index_type @_ @element_type @]
225
-
226
- cyma27_base_ext_params_ @ index_type @ _ @ element_type @ = copy . deepcopy ( ext_params )
227
- cyma27_base_ext_params_ @index_type @_ @element_type @[ 'libraries' ] = [ 'hsl_ma27' ]
228
- retval = os . getcwd ()
229
- os .chdir ( 'hsl/solvers/src' )
230
- call ([ 'cython' , '_cyma27_base_@index_type@_@element_type@.pyx' ] )
231
- os . chdir ( retval )
232
- config . add_extension (
233
- name = 'solvers.src._cyma27_base_@index_type@_@element_type@' ,
234
- sources = cyma27_sources_ @index_type @_ @element_type @,
235
- ** cyma27_base_ext_params_ @index_type @_ @element_type @)
236
-
237
- retval = os .getcwd ()
238
- os .chdir ('hsl/solvers/src' )
239
- call (['cython' , '_cyma27_numpy_@index_type@_@element_type@.pyx' ])
240
- os .chdir (retval )
241
- cyma27_numpy_ext_params_ @index_type @_ @element_type @ = copy .deepcopy (ext_params )
242
- config .add_extension (name = "solvers.src._cyma27_numpy_@index_type@_@element_type@" ,
243
- sources = ['hsl/solvers/src/_cyma27_numpy_@index_type@_@element_type@.c' ],
244
- ** cyma27_numpy_ext_params_ @index_type @_ @element_type @)
228
+ if files_exist ( ma27_sources ):
229
+ cyma27_src_ @ index_type @ _ @ element_type @ = [ 'ma27_lib .c' ,
230
+ 'hsl_alloc .c',
231
+ '_cyma27_base_ @index_type@_@element_type@.c' ]
232
+ cyma27_sources_ @ index_type @ _ @ element_type @ = [ os . path . join ( 'hsl' , 'solvers' , 'src' , name ) for name in cyma27_src_ @ index_type @ _ @ element_type @]
233
+
234
+ cyma27_base_ext_params_ @index_type @_ @element_type @ = copy . deepcopy ( ext_params )
235
+ cyma27_base_ext_params_ @ index_type @ _ @ element_type @[ 'libraries' ] = [ 'hsl_ma27' ]
236
+ retval = os .getcwd ( )
237
+ os . chdir ( 'hsl/solvers/src' )
238
+ call ([ 'cython' , '_cyma27_base_@index_type@_@element_type@.pyx' ] )
239
+ os . chdir ( retval )
240
+ config . add_extension ( name = 'solvers.src._cyma27_base_@index_type@_@element_type@' ,
241
+ sources = cyma27_sources_ @index_type @_ @element_type @,
242
+ ** cyma27_base_ext_params_ @index_type @_ @element_type @)
243
+
244
+ retval = os .getcwd ()
245
+ os .chdir ('hsl/solvers/src' )
246
+ call (['cython' , '_cyma27_numpy_@index_type@_@element_type@.pyx' ])
247
+ os .chdir (retval )
248
+ cyma27_numpy_ext_params_ @index_type @_ @element_type @ = copy .deepcopy (ext_params )
249
+ config .add_extension (name = "solvers.src._cyma27_numpy_@index_type@_@element_type@" ,
250
+ sources = ['hsl/solvers/src/_cyma27_numpy_@index_type@_@element_type@.c' ],
251
+ ** cyma27_numpy_ext_params_ @index_type @_ @element_type @)
245
252
246
253
{% endfor % }
247
254
{% endfor % }
248
255
249
256
250
257
{% for index_type in index_list % }
251
258
{% for element_type in type_list % }
252
- cyma57_src_ @index_type @_ @element_type @ = ['ma57_lib.c' ,
253
- 'hsl_alloc.c' ,
254
- '_cyma57_base_@index_type@_@element_type@.c' ]
255
- cyma57_sources_ @index_type @_ @element_type @ = [os .path .join ('hsl' , 'solvers' , 'src' , name ) for name in cyma57_src_ @index_type @_ @element_type @]
256
-
257
- base_ext_params_ @index_type @_ @element_type @ = copy .deepcopy (ext_params )
258
- base_ext_params_ @index_type @_ @element_type @['library_dirs' ] = [metis_dir ]
259
- base_ext_params_ @index_type @_ @element_type @['libraries' ] = [metis_lib , 'hsl_ma57' ]
260
- retval = os .getcwd ()
261
- os .chdir ('hsl/solvers/src' )
262
- call (['cython' , '_cyma57_base_@index_type@_@element_type@.pyx' ])
263
- os .chdir (retval )
264
- config .add_extension (
265
- name = 'solvers.src._cyma57_base_@index_type@_@element_type@' ,
266
- sources = cyma57_sources_ @index_type @_ @element_type @,
267
- ** base_ext_params_ @index_type @_ @element_type @)
268
-
269
- retval = os .getcwd ()
270
- os .chdir ('hsl/solvers/src' )
271
- call (['cython' , '_cyma57_numpy_@index_type@_@element_type@.pyx' ])
272
- os .chdir (retval )
273
- numpy_ext_params_ @index_type @_ @element_type @ = copy .deepcopy (ext_params )
274
- config .add_extension (name = "solvers.src._cyma57_numpy_@index_type@_@element_type@" ,
275
- sources = ['hsl/solvers/src/_cyma57_numpy_@index_type@_@element_type@.c' ],
276
- ** numpy_ext_params_ @index_type @_ @element_type @)
259
+ if files_exist (ma57_sources ):
260
+ cyma57_src_ @index_type @_ @element_type @ = ['ma57_lib.c' ,
261
+ 'hsl_alloc.c' ,
262
+ '_cyma57_base_@index_type@_@element_type@.c' ]
263
+ cyma57_sources_ @index_type @_ @element_type @ = [os .path .join ('hsl' , 'solvers' , 'src' , name ) for name in cyma57_src_ @index_type @_ @element_type @]
264
+
265
+ base_ext_params_ @index_type @_ @element_type @ = copy .deepcopy (ext_params )
266
+ base_ext_params_ @index_type @_ @element_type @['library_dirs' ] = [metis_dir ]
267
+ base_ext_params_ @index_type @_ @element_type @['libraries' ] = [metis_lib , 'hsl_ma57' ]
268
+ retval = os .getcwd ()
269
+ os .chdir ('hsl/solvers/src' )
270
+ call (['cython' , '_cyma57_base_@index_type@_@element_type@.pyx' ])
271
+ os .chdir (retval )
272
+ config .add_extension (
273
+ name = 'solvers.src._cyma57_base_@index_type@_@element_type@' ,
274
+ sources = cyma57_sources_ @index_type @_ @element_type @,
275
+ ** base_ext_params_ @index_type @_ @element_type @)
276
+
277
+ retval = os .getcwd ()
278
+ os .chdir ('hsl/solvers/src' )
279
+ call (['cython' , '_cyma57_numpy_@index_type@_@element_type@.pyx' ])
280
+ os .chdir (retval )
281
+ numpy_ext_params_ @index_type @_ @element_type @ = copy .deepcopy (ext_params )
282
+ config .add_extension (name = "solvers.src._cyma57_numpy_@index_type@_@element_type@" ,
283
+ sources = ['hsl/solvers/src/_cyma57_numpy_@index_type@_@element_type@.c' ],
284
+ ** numpy_ext_params_ @index_type @_ @element_type @)
277
285
278
286
{% endfor % }
279
287
{% endfor % }
280
288
281
289
if build_cysparse_ext :
282
290
{% for index_type in index_list % }
283
291
{% for element_type in type_list % }
284
- retval = os .getcwd ()
285
- os .chdir ('hsl/solvers/src' )
286
- call (['cython' , '-I' , cysparse_rootdir [0 ], '_cyma27_cysparse_@index_type@_@element_type@.pyx' ])
287
- os .chdir (retval )
288
- cyma27_cysparse_ext_params_ @index_type @_ @element_type @ = copy .deepcopy (ext_params )
289
- cyma27_cysparse_ext_params_ @index_type @_ @element_type @['include_dirs' ].extend (cysparse_rootdir )
290
- config .add_extension (name = "solvers.src._cyma27_cysparse_@index_type@_@element_type@" ,
291
- sources = ['hsl/solvers/src/_cyma27_cysparse_@index_type@_@element_type@.c' ],
292
- ** cyma27_cysparse_ext_params_ @index_type @_ @element_type @)
292
+ if files_exist (ma27_sources ):
293
+ retval = os .getcwd ()
294
+ os .chdir ('hsl/solvers/src' )
295
+ call (['cython' , '-I' , cysparse_rootdir [0 ], '_cyma27_cysparse_@index_type@_@element_type@.pyx' ])
296
+ os .chdir (retval )
297
+ cyma27_cysparse_ext_params_ @index_type @_ @element_type @ = copy .deepcopy (ext_params )
298
+ cyma27_cysparse_ext_params_ @index_type @_ @element_type @['include_dirs' ].extend (cysparse_rootdir )
299
+ config .add_extension (name = "solvers.src._cyma27_cysparse_@index_type@_@element_type@" ,
300
+ sources = ['hsl/solvers/src/_cyma27_cysparse_@index_type@_@element_type@.c' ],
301
+ ** cyma27_cysparse_ext_params_ @index_type @_ @element_type @ )
293
302
{% endfor % }
294
303
{% endfor % }
295
304
296
305
{% for index_type in index_list % }
297
306
{% for element_type in type_list % }
298
- retval = os .getcwd ()
299
- os .chdir ('hsl/solvers/src' )
300
- call (['cython' , '-I' , cysparse_rootdir [0 ], '_cyma57_cysparse_@index_type@_@element_type@.pyx' ])
301
- os .chdir (retval )
302
- cyma57_cysparse_ext_params_ @index_type @_ @element_type @ = copy .deepcopy (ext_params )
303
- cyma57_cysparse_ext_params_ @index_type @_ @element_type @['include_dirs' ].extend (cysparse_rootdir )
304
- config .add_extension (name = "solvers.src._cyma57_cysparse_@index_type@_@element_type@" ,
305
- sources = ['hsl/solvers/src/_cyma57_cysparse_@index_type@_@element_type@.c' ],
306
- ** cyma57_cysparse_ext_params_ @index_type @_ @element_type @)
307
+ if files_exist (ma57_sources ):
308
+ retval = os .getcwd ()
309
+ os .chdir ('hsl/solvers/src' )
310
+ call (['cython' , '-I' , cysparse_rootdir [0 ], '_cyma57_cysparse_@index_type@_@element_type@.pyx' ])
311
+ os .chdir (retval )
312
+ cyma57_cysparse_ext_params_ @index_type @_ @element_type @ = copy .deepcopy (ext_params )
313
+ cyma57_cysparse_ext_params_ @index_type @_ @element_type @['include_dirs' ].extend (cysparse_rootdir )
314
+ config .add_extension (name = "solvers.src._cyma57_cysparse_@index_type@_@element_type@" ,
315
+ sources = ['hsl/solvers/src/_cyma57_cysparse_@index_type@_@element_type@.c' ],
316
+ ** cyma57_cysparse_ext_params_ @index_type @_ @element_type @)
307
317
{% endfor % }
308
318
{% endfor % }
309
319
@@ -333,4 +343,9 @@ with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f:
333
343
334
344
config .make_config_py ()
335
345
336
- setup (packages = packages_list , zip_safe = False , ** config .todict ())
346
+ if config .ext_modules == []:
347
+ msg = "Not building HSL.py, please provide some source files for"
348
+ msg += " either mc21, mc29, mc60, ma27 or ma57"
349
+ print msg
350
+ else :
351
+ setup (packages = packages_list , zip_safe = False , ** config .todict ())
0 commit comments