Create pyd files in their original folder structure using setuptools

Viewed 175

Folder structure for the python files:

myProject/
  setup.py
  src/
     dir1/
        dir1file1.py
        dir1file2.py
     dir2/
        dir2file1.py
        dir2file2.py
        dir2file3.py
     dir3/
        sub_dir3_1/
            sub_dir3_1file1.py
        sub_dir3_2/
            sub_dir3_2file1.py

The setup.py file to cythonize all the python files:

from setuptools import setup, Extension
from Cython.Build import cythonize

ext_modules = extensions = [
    Extension("*", ["./src/*.py"]),
    Extension("*", ["./src/*/*.py"]),
    Extension("*", ["./src/*/*/*.py"]),
]

setup(
    ext_modules = cythonize(ext_modules, 
        build_dir="build_cfiles")
)

The command used to execute setup.py for keeping the cython-compliled pyd files in one folder under myProject.

python setup.py build_ext --build-lib my_build

All the pyd files are coming all together under my_build folder but I want the same folder structure as src folder to be created inside the my_build folder. What should I add to my setup function to get the above mentioned result? Or how should I change the extensions to get the same?

0 Answers
Related