def wrap_command(cmd, cmdclass, hooks): def run(self, cmdclass=cmdclass): self.run_command_hooks('pre_hook') cmdclass.run(self) self.run_command_hooks('post_hook') return type(cmd, (cmdclass, object), {'run': run, 'run_command_hooks': run_command_hooks, 'pre_hook': hooks.get('pre_hook'), 'post_hook': hooks.get('post_hook')})
def wrap_command(cmd, cmdclass, hooks): def run(self, cmdclass=cmdclass): self.run_command_hooks("pre_hook") cmdclass.run(self) self.run_command_hooks("post_hook") return type( cmd, (cmdclass, object), { "run": run, "run_command_hooks": run_command_hooks, "pre_hook": hooks.get("pre_hook"), "post_hook": hooks.get("post_hook"), }, )