But this doesn't look quite complete. I don't see where the Python interpreter is actually invoked here. (Cute trick swapping the args, by the way).
Which is presumably why, in finalize_options, we find:
if self.pre_install_script: raise DistutilsOptionError, "the pre-install-script feature is not yet implemented"
Shouldn't the custom action be this:
add_data(self.db, "CustomAction", [("PreInstall", 2, "PreInstall", '"PYTHON"'), ])
I don't remember the details, but one problem might have been that custom action 2 is defined as "EXE file stored in a Binary table stream." Not sure whether batch files are even allowed here. In any case, the value should probably be '"[PYTHON]"', then so that the property gets expanded. Regards, Martin