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.
Asked
Active
Viewed 1,279 times
7
-
Do you want the conversion to be done when the module is loaded or are you planning on doing it some time beforehand in a different step? – Will Oct 01 '12 at 14:47
1 Answers
2
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.

Community
- 1
- 1

Matthew Trevor
- 14,354
- 6
- 37
- 50