@@ -311,7 +311,6 @@ class CheckSDist(sdist_class):
311
311
'pandas/_libs/missing.pyx' ,
312
312
'pandas/_libs/reduction.pyx' ,
313
313
'pandas/_libs/testing.pyx' ,
314
- 'pandas/_libs/window.pyx' ,
315
314
'pandas/_libs/skiplist.pyx' ,
316
315
'pandas/_libs/sparse.pyx' ,
317
316
'pandas/_libs/parsers.pyx' ,
@@ -331,19 +330,28 @@ class CheckSDist(sdist_class):
331
330
'pandas/_libs/writers.pyx' ,
332
331
'pandas/io/sas/sas.pyx' ]
333
332
333
+ _cpp_pyxfiles = ['pandas/_libs/window.pyx' ,
334
+ 'pandas/io/msgpack/_packer.pyx' ,
335
+ 'pandas/io/msgpack/_unpacker.pyx' ]
336
+
334
337
def initialize_options (self ):
335
338
sdist_class .initialize_options (self )
336
339
337
340
def run (self ):
338
341
if 'cython' in cmdclass :
339
342
self .run_command ('cython' )
340
343
else :
341
- for pyxfile in self ._pyxfiles :
342
- cfile = pyxfile [:- 3 ] + 'c'
343
- msg = ("C-source file '{source}' not found.\n "
344
- "Run 'setup.py cython' before sdist." .format (
345
- source = cfile ))
346
- assert os .path .isfile (cfile ), msg
344
+ # If we are not running cython then
345
+ # compile the extensions correctly
346
+ pyx_files = [(self ._pyxfiles , 'c' ), (self ._cpp_pyxfiles , 'cpp' )]
347
+
348
+ for pyxfiles , extension in pyx_files :
349
+ for pyxfile in pyxfiles :
350
+ sourcefile = pyxfile [:- 3 ] + extension
351
+ msg = ("{extension}-source file '{source}' not found.\n "
352
+ "Run 'setup.py cython' before sdist." .format (
353
+ source = sourcefile , extension = extension ))
354
+ assert os .path .isfile (sourcefile ), msg
347
355
sdist_class .run (self )
348
356
349
357
@@ -417,6 +425,11 @@ def get_tag(self):
417
425
cmdclass ['build_src' ] = DummyBuildSrc
418
426
cmdclass ['build_ext' ] = CheckingBuildExt
419
427
428
+ if sys .byteorder == 'big' :
429
+ endian_macro = [('__BIG_ENDIAN__' , '1' )]
430
+ else :
431
+ endian_macro = [('__LITTLE_ENDIAN__' , '1' )]
432
+
420
433
lib_depends = ['inference' ]
421
434
422
435
@@ -453,6 +466,7 @@ def pxd(name):
453
466
'pandas/_libs/src/datetime/np_datetime_strings.h' ]
454
467
np_datetime_sources = ['pandas/_libs/src/datetime/np_datetime.c' ,
455
468
'pandas/_libs/src/datetime/np_datetime_strings.c' ]
469
+
456
470
tseries_depends = np_datetime_headers + ['pandas/_libs/tslibs/np_datetime.pxd' ]
457
471
458
472
# some linux distros require it
@@ -618,17 +632,42 @@ def pxd(name):
618
632
'_libs.window' : {
619
633
'pyxfile' : '_libs/window' ,
620
634
'pxdfiles' : ['_libs/skiplist' , '_libs/src/util' ],
621
- 'language' : 'c++' },
635
+ 'language' : 'c++' ,
636
+ 'suffix' : '.cpp' },
622
637
'_libs.writers' : {
623
638
'pyxfile' : '_libs/writers' ,
624
639
'pxdfiles' : ['_libs/src/util' ]},
625
640
'io.sas._sas' : {
626
- 'pyxfile' : 'io/sas/sas' }}
641
+ 'pyxfile' : 'io/sas/sas' },
642
+ 'io.msgpack._packer' : {
643
+ 'macros' : endian_macro ,
644
+ 'depends' : ['pandas/_libs/src/msgpack/pack.h' ,
645
+ 'pandas/_libs/src/msgpack/pack_template.h' ],
646
+ 'include' : ['pandas/_libs/src/msgpack' ] + common_include ,
647
+ 'language' : 'c++' ,
648
+ 'suffix' : '.cpp' ,
649
+ 'pyxfile' : 'io/msgpack/_packer' ,
650
+ 'subdir' : 'io/msgpack' },
651
+ 'io.msgpack._unpacker' : {
652
+ 'depends' : ['pandas/_libs/src/msgpack/unpack.h' ,
653
+ 'pandas/_libs/src/msgpack/unpack_define.h' ,
654
+ 'pandas/_libs/src/msgpack/unpack_template.h' ],
655
+ 'macros' : endian_macro ,
656
+ 'include' : ['pandas/_libs/src/msgpack' ] + common_include ,
657
+ 'language' : 'c++' ,
658
+ 'suffix' : '.cpp' ,
659
+ 'pyxfile' : 'io/msgpack/_unpacker' ,
660
+ 'subdir' : 'io/msgpack'
661
+ }
662
+ }
627
663
628
664
extensions = []
629
665
630
666
for name , data in ext_data .items ():
631
- sources = [srcpath (data ['pyxfile' ], suffix = suffix , subdir = '' )]
667
+ source_suffix = suffix if suffix == '.pyx' else data .get ('suffix' , '.c' )
668
+
669
+ sources = [srcpath (data ['pyxfile' ], suffix = source_suffix , subdir = '' )]
670
+
632
671
pxds = [pxd (x ) for x in data .get ('pxdfiles' , [])]
633
672
if suffix == '.pyx' and pxds :
634
673
sources .extend (pxds )
@@ -642,46 +681,11 @@ def pxd(name):
642
681
depends = data .get ('depends' , []),
643
682
include_dirs = include ,
644
683
language = data .get ('language' , 'c' ),
684
+ define_macros = data .get ('macros' , []),
645
685
extra_compile_args = extra_compile_args )
646
686
647
687
extensions .append (obj )
648
688
649
- # ----------------------------------------------------------------------
650
- # msgpack
651
-
652
- if sys .byteorder == 'big' :
653
- macros = [('__BIG_ENDIAN__' , '1' )]
654
- else :
655
- macros = [('__LITTLE_ENDIAN__' , '1' )]
656
-
657
- msgpack_include = ['pandas/_libs/src/msgpack' ] + common_include
658
- msgpack_suffix = suffix if suffix == '.pyx' else '.cpp'
659
- unpacker_depends = ['pandas/_libs/src/msgpack/unpack.h' ,
660
- 'pandas/_libs/src/msgpack/unpack_define.h' ,
661
- 'pandas/_libs/src/msgpack/unpack_template.h' ]
662
-
663
- packer_ext = Extension ('pandas.io.msgpack._packer' ,
664
- depends = ['pandas/_libs/src/msgpack/pack.h' ,
665
- 'pandas/_libs/src/msgpack/pack_template.h' ],
666
- sources = [srcpath ('_packer' ,
667
- suffix = msgpack_suffix ,
668
- subdir = 'io/msgpack' )],
669
- language = 'c++' ,
670
- include_dirs = msgpack_include ,
671
- define_macros = macros ,
672
- extra_compile_args = extra_compile_args )
673
- unpacker_ext = Extension ('pandas.io.msgpack._unpacker' ,
674
- depends = unpacker_depends ,
675
- sources = [srcpath ('_unpacker' ,
676
- suffix = msgpack_suffix ,
677
- subdir = 'io/msgpack' )],
678
- language = 'c++' ,
679
- include_dirs = msgpack_include ,
680
- define_macros = macros ,
681
- extra_compile_args = extra_compile_args )
682
- extensions .append (packer_ext )
683
- extensions .append (unpacker_ext )
684
-
685
689
# ----------------------------------------------------------------------
686
690
# ujson
687
691
0 commit comments