2

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.