From: Stefan Behnel Date: Sat, 13 Mar 2010 06:06:00 +0000 (+0100) Subject: find .pxd include directories automatically during installation X-Git-Tag: 0.13.beta0~318^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5409958be02a5e5c9c3fdaef41d04add1578f66d;p=cython.git find .pxd include directories automatically during installation --- diff --git a/setup.py b/setup.py index 6a3acdb9..2b234913 100644 --- a/setup.py +++ b/setup.py @@ -37,32 +37,35 @@ if sys.version_info[0] >= 3: build_py.fixer_names = fixers add_command_class("build_py", build_py) -pxd_packages = ['cpython', 'libc', 'libcpp'] +pxd_include_dirs = [ + directory for directory, dirs, files in os.walk('Cython/Includes') + if '__init__.pyx' in files or '__init__.pxd' in files + or directory == 'Cython/Includes' ] + +pxd_include_patterns = [ + p+'/*.pxd' for p in pxd_include_dirs ] + [ + p+'/*.pyx' for p in pxd_include_dirs ] if sys.version_info < (2,4): install_base_dir = get_python_lib(prefix='') import glob - patterns = ['Cython/Includes/*.pxd', - 'Cython/Plex/*.pxd', - 'Cython/Compiler/*.pxd', - 'Cython/Runtime/*.pyx'] - for p in pxd_packages: - patterns.append('Cython/Includes/%s/*.pxd' % p) - patterns.append('Cython/Includes/%s/__init__.pyx' % p) + patterns = pxd_include_patterns + [ + 'Cython/Plex/*.pxd', + 'Cython/Compiler/*.pxd', + 'Cython/Runtime/*.pyx' + ] setup_args['data_files'] = [ (os.path.dirname(os.path.join(install_base_dir, pattern)), [ f for f in glob.glob(pattern) ]) for pattern in patterns ] else: - patterns = ['Includes/*.pxd', - 'Plex/*.pxd', - 'Compiler/*.pxd', - 'Runtime/*.pyx'] - for p in pxd_packages: - patterns.append('Includes/%s/*.pxd' % p) - patterns.append('Includes/%s/__init__.pyx' % p) - setup_args['package_data'] = {'Cython' : patterns} + setup_args['package_data'] = { + 'Cython.Plex' : ['*.pxd'], + 'Cython.Compiler' : ['*.pxd'], + 'Cython.Runtime' : ['*.pyx', '*.pxd'], + 'Cython' : [ p[7:] for p in pxd_include_patterns ], + } # This dict is used for passing extra arguments that are setuptools # specific to setup