~ubuntu-branches/ubuntu/precise/python-numpy/precise

« back to all changes in this revision

Viewing changes to numpy/distutils/command/build_src.py

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2012-02-11 12:55:21 UTC
  • mfrom: (7.1.9 experimental) (7.2.3 sid)
  • Revision ID: package-import@ubuntu.com-20120211125521-31q3am7pp3mvt1ho
Tags: 1:1.6.1-5ubuntu1
* debian/patches/search-multiarch-paths.patch: (LP: #818867)
  - add multiarch libdirs to numpy.distutils.system_info
* Merge from Debian unstable, remaining changes:
  - debian/patches/20_disable-plot-extension.patch
     Disable plot_directive extension, and catch ImportErrors when
     matplotlib cannot be imported, which allows us to remove
     python-matplotlib from dependencies.  This is required because
     python-numpy is in main, while python-matplotlib is in universe.
  - Build using dh_python2
    add bin/f2py* to .install files
  - keep Replaces: python-numpy (<< 1:1.3.0-4) in python-numpy-dbg
    for lucid upgrades

Show diffs side-by-side

added added

removed removed

Lines of Context:
640
640
        target_dirs = []
641
641
        py_files = []     # swig generated .py files
642
642
        target_ext = '.c'
643
 
        if self.swig_cpp:
 
643
        if '-c++' in extension.swig_opts:
 
644
            typ = 'c++'
 
645
            is_cpp = True
 
646
            extension.swig_opts.remove('-c++')
 
647
        elif self.swig_cpp:
644
648
            typ = 'c++'
645
649
            is_cpp = True
646
650
        else:
652
656
        for source in sources:
653
657
            (base, ext) = os.path.splitext(source)
654
658
            if ext == '.i': # SWIG interface file
 
659
                # the code below assumes that the sources list
 
660
                # contains not more than one .i SWIG interface file
655
661
                if self.inplace:
656
662
                    target_dir = os.path.dirname(base)
657
663
                    py_target_dir = self.ext_target_dir
667
673
                    if typ is None:
668
674
                        typ = get_swig_target(source)
669
675
                        is_cpp = typ=='c++'
670
 
                        if is_cpp: target_ext = '.cpp'
 
676
                        if is_cpp: 
 
677
                            target_ext = '.cpp'
671
678
                    else:
672
679
                        typ2 = get_swig_target(source)
673
 
                        if typ!=typ2:
 
680
                        if typ2 is None:
 
681
                            log.warn('source %r does not define swig target, assuming %s swig target' \
 
682
                                     % (source, typ))
 
683
                            if is_cpp: 
 
684
                                target_ext = '.cpp'
 
685
                        elif typ!=typ2:
674
686
                            log.warn('expected %r but source %r defines %r swig target' \
675
687
                                     % (typ, source, typ2))
676
688
                            if typ2=='c++':
716
728
            self.mkpath(d)
717
729
 
718
730
        swig = self.swig or self.find_swig()
719
 
        swig_cmd = [swig, "-python"]
 
731
        swig_cmd = [swig, "-python"] + extension.swig_opts
720
732
        if is_cpp:
721
733
            swig_cmd.append('-c++')
722
734
        for d in extension.include_dirs:
746
758
 
747
759
def get_swig_target(source):
748
760
    f = open(source,'r')
749
 
    result = 'c'
 
761
    result = None
750
762
    line = f.readline()
751
763
    if _has_cpp_header(line):
752
764
        result = 'c++'