(self, sources, extension)
| 464 | return [] |
| 465 | |
| 466 | def f2py_sources(self, sources, extension): |
| 467 | new_sources = [] |
| 468 | f2py_sources = [] |
| 469 | f_sources = [] |
| 470 | f2py_targets = {} |
| 471 | target_dirs = [] |
| 472 | ext_name = extension.name.split('.')[-1] |
| 473 | skip_f2py = 0 |
| 474 | |
| 475 | for source in sources: |
| 476 | (base, ext) = os.path.splitext(source) |
| 477 | if ext == '.pyf': # F2PY interface file |
| 478 | if self.inplace: |
| 479 | target_dir = os.path.dirname(base) |
| 480 | else: |
| 481 | target_dir = appendpath(self.build_src, os.path.dirname(base)) |
| 482 | if os.path.isfile(source): |
| 483 | name = get_f2py_modulename(source) |
| 484 | if name != ext_name: |
| 485 | raise DistutilsSetupError('mismatch of extension names: %s ' |
| 486 | 'provides %r but expected %r' % ( |
| 487 | source, name, ext_name)) |
| 488 | target_file = os.path.join(target_dir, name+'module.c') |
| 489 | else: |
| 490 | log.debug(' source %s does not exist: skipping f2py\'ing.' \ |
| 491 | % (source)) |
| 492 | name = ext_name |
| 493 | skip_f2py = 1 |
| 494 | target_file = os.path.join(target_dir, name+'module.c') |
| 495 | if not os.path.isfile(target_file): |
| 496 | log.warn(' target %s does not exist:\n '\ |
| 497 | 'Assuming %smodule.c was generated with '\ |
| 498 | '"build_src --inplace" command.' \ |
| 499 | % (target_file, name)) |
| 500 | target_dir = os.path.dirname(base) |
| 501 | target_file = os.path.join(target_dir, name+'module.c') |
| 502 | if not os.path.isfile(target_file): |
| 503 | raise DistutilsSetupError("%r missing" % (target_file,)) |
| 504 | log.info(' Yes! Using %r as up-to-date target.' \ |
| 505 | % (target_file)) |
| 506 | target_dirs.append(target_dir) |
| 507 | f2py_sources.append(source) |
| 508 | f2py_targets[source] = target_file |
| 509 | new_sources.append(target_file) |
| 510 | elif fortran_ext_match(ext): |
| 511 | f_sources.append(source) |
| 512 | else: |
| 513 | new_sources.append(source) |
| 514 | |
| 515 | if not (f2py_sources or f_sources): |
| 516 | return new_sources |
| 517 | |
| 518 | for d in target_dirs: |
| 519 | self.mkpath(d) |
| 520 | |
| 521 | f2py_options = extension.f2py_options + self.f2py_opts |
| 522 | |
| 523 | if self.distribution.libraries: |
no test coverage detected