I am generating some Python files in my setup.py
as part of the build process. These files should be part of the installation. I have successfully added my code generator as a pre-build step (by implementing my own Command
and overriding the default build
to include this).
How do I copy my generated files from the temporary directory into the build output? Should I copy it myself using e.g. copy_file
? If so, how do I get the path to the build output? Or should I declare it as part of the build somehow?
I'd rather not clutter the source directory tree with my generated files, hence I prefer to avoid copying the files there and then declaring them as part of the package.
I solved this by subclassing build_py
instead of build
. It turns out build_py
has a build_lib
attribute that will be the path to the "build" directory.
By looking at the source code I think there is no better way.