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 = """
@@ -341,10 +341,7 @@ def check_cython_extensions(self, extensions):
341
341
342
342
def build_extensions (self ):
343
343
self .check_cython_extensions (self .extensions )
344
- self .check_extensions_list (self .extensions )
345
-
346
- for ext in self .extensions :
347
- self .build_extension (ext )
344
+ build_ext .build_extensions (self )
348
345
349
346
350
347
class CompilationCacheMixin (object ):
@@ -577,7 +574,7 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
577
574
lib_depends = []
578
575
plib_depends = []
579
576
580
- common_include = [np . get_include (), 'pandas/src/klib' , 'pandas/src' ]
577
+ common_include = ['pandas/src/klib' , 'pandas/src' ]
581
578
582
579
583
580
def pxd (name ):
@@ -636,7 +633,7 @@ def pxd(name):
636
633
637
634
sparse_ext = Extension ('pandas._sparse' ,
638
635
sources = [srcpath ('sparse' , suffix = suffix )],
639
- include_dirs = [np . get_include () ],
636
+ include_dirs = [],
640
637
libraries = libraries )
641
638
642
639
@@ -658,7 +655,7 @@ def pxd(name):
658
655
cppsandbox_ext = Extension ('pandas._cppsandbox' ,
659
656
language = 'c++' ,
660
657
sources = [srcpath ('cppsandbox' , suffix = suffix )],
661
- include_dirs = [np . get_include () ])
658
+ include_dirs = [])
662
659
663
660
extensions .extend ([sparse_ext , parser_ext ])
664
661
0 commit comments