(self, sources, extension)
| 602 | return new_sources + f_sources |
| 603 | |
| 604 | def swig_sources(self, sources, extension): |
| 605 | # Assuming SWIG 1.3.14 or later. See compatibility note in |
| 606 | # http://www.swig.org/Doc1.3/Python.html#Python_nn6 |
| 607 | |
| 608 | new_sources = [] |
| 609 | swig_sources = [] |
| 610 | swig_targets = {} |
| 611 | target_dirs = [] |
| 612 | py_files = [] # swig generated .py files |
| 613 | target_ext = '.c' |
| 614 | if '-c++' in extension.swig_opts: |
| 615 | typ = 'c++' |
| 616 | is_cpp = True |
| 617 | extension.swig_opts.remove('-c++') |
| 618 | elif self.swig_cpp: |
| 619 | typ = 'c++' |
| 620 | is_cpp = True |
| 621 | else: |
| 622 | typ = None |
| 623 | is_cpp = False |
| 624 | skip_swig = 0 |
| 625 | ext_name = extension.name.split('.')[-1] |
| 626 | |
| 627 | for source in sources: |
| 628 | (base, ext) = os.path.splitext(source) |
| 629 | if ext == '.i': # SWIG interface file |
| 630 | # the code below assumes that the sources list |
| 631 | # contains not more than one .i SWIG interface file |
| 632 | if self.inplace: |
| 633 | target_dir = os.path.dirname(base) |
| 634 | py_target_dir = self.ext_target_dir |
| 635 | else: |
| 636 | target_dir = appendpath(self.build_src, os.path.dirname(base)) |
| 637 | py_target_dir = target_dir |
| 638 | if os.path.isfile(source): |
| 639 | name = get_swig_modulename(source) |
| 640 | if name != ext_name[1:]: |
| 641 | raise DistutilsSetupError( |
| 642 | 'mismatch of extension names: %s provides %r' |
| 643 | ' but expected %r' % (source, name, ext_name[1:])) |
| 644 | if typ is None: |
| 645 | typ = get_swig_target(source) |
| 646 | is_cpp = typ=='c++' |
| 647 | else: |
| 648 | typ2 = get_swig_target(source) |
| 649 | if typ2 is None: |
| 650 | log.warn('source %r does not define swig target, assuming %s swig target' \ |
| 651 | % (source, typ)) |
| 652 | elif typ!=typ2: |
| 653 | log.warn('expected %r but source %r defines %r swig target' \ |
| 654 | % (typ, source, typ2)) |
| 655 | if typ2=='c++': |
| 656 | log.warn('resetting swig target to c++ (some targets may have .c extension)') |
| 657 | is_cpp = True |
| 658 | else: |
| 659 | log.warn('assuming that %r has c++ swig target' % (source)) |
| 660 | if is_cpp: |
| 661 | target_ext = '.cpp' |
no test coverage detected