I've got some XML files from which I intend to derive some python source code; they are things like lists of language codes. Does the distribute module have a hook I can plug into for this purpose? To be perhaps clearer, I don't want to ship XML around. I want to only ship .py files. I want to derive some .py files by running a program that generates them from XML.
Cog is a simple code generation tool written in Python. We use it or its results every day in the production of Kubi. Kubi is a collaboration system embodied in a handful of different products.
The setup.py file may be the most significant file that should be placed at the root of the Python project directory. It primarily serves two purposes: It includes choices and metadata about the program, such as the package name, version, author, license, minimal dependencies, entry points, data files, and so on.
The setup script is the centre of all activity in building, distributing, and installing modules using the Distutils. The main purpose of the setup script is to describe your module distribution to the Distutils, so that the various commands that operate on your modules do the right thing.
You could create a custom distutils command for your code gen process, or you can override build itself. This would require you to include the XML, though.
I'd probably move the code generation into my local build process, using zc.buildout with a templating recipe like z3c.recipe.template. The XML would then be part of the development build, with only the code generated Python files included in the user distribution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With