85
85
" use pip or easy_install."
86
86
"\n $ pip install 'python-dateutil < 2' 'numpy'" )
87
87
88
- try :
89
- import numpy as np
90
- except ImportError :
91
- nonumpy_msg = ("# numpy needed to finish setup. run:\n \n "
92
- " $ pip install numpy # or easy_install numpy\n " )
93
- sys .exit (nonumpy_msg )
94
-
95
- if np .__version__ < '1.6.1' :
96
- msg = "pandas requires NumPy >= 1.6.1 due to datetime64 dependency"
97
- sys .exit (msg )
98
-
99
88
from distutils .extension import Extension
100
89
from distutils .command .build import build
101
90
from distutils .command .sdist import sdist
102
- from distutils .command .build_ext import build_ext
91
+ from distutils .command .build_ext import build_ext as _build_ext
103
92
104
93
try :
105
- from Cython .Distutils import build_ext
94
+ from Cython .Distutils import build_ext as _build_ext
106
95
# from Cython.Distutils import Extension # to get pyrex debugging symbols
107
96
cython = True
108
97
except ImportError :
109
98
cython = False
110
99
111
100
from os .path import splitext , basename , join as pjoin
112
101
102
+
103
+ class build_ext (_build_ext ):
104
+ def build_extensions (self ):
105
+ numpy_incl = pkg_resources .resource_filename ('numpy' , 'core/include' )
106
+
107
+ for ext in self .extensions :
108
+ if hasattr (ext , 'include_dirs' ) and not numpy_incl in ext .include_dirs :
109
+ ext .include_dirs .append (numpy_incl )
110
+ _build_ext .build_extensions (self )
111
+
112
+
113
113
DESCRIPTION = ("Powerful data structures for data analysis, time series,"
114
114
"and statistics" )
115
115
LONG_DESCRIPTION = """
@@ -340,10 +340,7 @@ def check_cython_extensions(self, extensions):
340
340
341
341
def build_extensions (self ):
342
342
self .check_cython_extensions (self .extensions )
343
- self .check_extensions_list (self .extensions )
344
-
345
- for ext in self .extensions :
346
- self .build_extension (ext )
343
+ build_ext .build_extensions (self )
347
344
348
345
349
346
class CompilationCacheMixin (object ):
@@ -576,7 +573,7 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
576
573
lib_depends = []
577
574
plib_depends = []
578
575
579
- common_include = [np . get_include (), 'pandas/src/klib' , 'pandas/src' ]
576
+ common_include = ['pandas/src/klib' , 'pandas/src' ]
580
577
581
578
582
579
def pxd (name ):
@@ -635,7 +632,7 @@ def pxd(name):
635
632
636
633
sparse_ext = Extension ('pandas._sparse' ,
637
634
sources = [srcpath ('sparse' , suffix = suffix )],
638
- include_dirs = [np . get_include () ],
635
+ include_dirs = [],
639
636
libraries = libraries )
640
637
641
638
@@ -657,7 +654,7 @@ def pxd(name):
657
654
cppsandbox_ext = Extension ('pandas._cppsandbox' ,
658
655
language = 'c++' ,
659
656
sources = [srcpath ('cppsandbox' , suffix = suffix )],
660
- include_dirs = [np . get_include () ])
657
+ include_dirs = [])
661
658
662
659
extensions .extend ([sparse_ext , parser_ext ])
663
660
0 commit comments