11#-----------------------------------------------------------------------------
2- # Copyright (c) 2013, Allen B. Riddell
2+ # Copyright (c) 2013-2014 , Allen B. Riddell
33#
44# This file is licensed under Version 3.0 of the GNU General Public
55# License. See LICENSE for a text of the license.
@@ -71,22 +71,16 @@ def find_version(*parts):
7171 cython = False
7272
7373
74- # use CheckSDist strategy from pandas
7574class CheckSDist (sdist ):
7675 """Custom sdist that ensures Cython has compiled all pyx files to c."""
7776
78- _pyxfiles = ['horizont/_lda.pyx' ]
79-
8077 def initialize_options (self ):
8178 sdist .initialize_options (self )
82-
83- '''
84- self._pyxfiles = []
85- for root, dirs, files in os.walk('pandas'):
86- for f in files:
87- if f.endswith('.pyx'):
88- self._pyxfiles.append(pjoin(root, f))
89- '''
79+ self ._pyxfiles = []
80+ for root , dirs , files in os .walk ('horizont' ):
81+ for f in files :
82+ if f .endswith ('.pyx' ):
83+ self ._pyxfiles .append (os .path .join (root , f ))
9084
9185 def run (self ):
9286 if 'cython' in cmdclass :
@@ -115,9 +109,7 @@ def run(self):
115109
116110include_gsl_dir = os .environ .get ('GSL_INC_DIR' , "/usr/include/" )
117111lib_gsl_dir = os .environ .get ('GSL_LIB_DIR' , "/usr/lib/" )
118- random_include_dirs = ["horizont/BayesLogit/Code/C" ,
119- "horizont/RNG" ,
120- include_gsl_dir ]
112+ random_include_dirs = ["horizont/BayesLogit/Code/C" , "horizont/RNG" , include_gsl_dir ]
121113random_library_dirs = [lib_gsl_dir ]
122114random_libraries = ['gsl' , 'gslcblas' ]
123115
@@ -147,6 +139,17 @@ def run(self):
147139import numpy
148140include_dirs = [numpy .get_include ()]
149141
142+ # package data
143+ package_data_pats = ['*.hpp' , '*.pxd' , '*.pyx' , 'tests/*.dat' , 'tests/*.ldac' ]
144+
145+ # get every file under horizont/BayesLogit/Code/C/", "horizont/RNG/"
146+ package_data_pats += sum (
147+ [[os .path .join (path .replace ('horizont/' , '' ), fn ) for fn in files ]
148+ for path , dirs , files in os .walk ('horizont/BayesLogit/Code/C/' )], [])
149+
150+ package_data_pats += sum (
151+ [[os .path .join (path .replace ('horizont/' , '' ), fn ) for fn in files ]
152+ for path , dirs , files in os .walk ('horizont/RNG/' )], [])
150153
151154###########################################################################
152155# Setup proper
@@ -165,5 +168,5 @@ def run(self):
165168 classifiers = CLASSIFIERS ,
166169 ext_modules = extensions ,
167170 include_dirs = include_dirs ,
168- package_data = {'horizont.tests' : [ 'ap.dat' , 'ch.ldac' ] },
171+ package_data = {'horizont' : package_data_pats },
169172 platforms = 'any' )
0 commit comments