+# Using deferred evaluation
+daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
+daemons/ganeti-watcher: MODULE = ganeti.watcher
+scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
+
+$(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
+ test -n "$(MODULE)" || { echo Missing module; exit 1; }
+ set -e; \
+ { echo '#!/usr/bin/python'; \
+ echo '# This file is automatically generated, do not edit!'; \
+ echo "# Edit $(MODULE) instead."; \
+ echo; \
+ echo '"""Bootstrap script for L{$(MODULE)}"""'; \
+ echo; \
+ echo '# pylint: disable-msg=C0103'; \
+ echo '# C0103: Invalid name'; \
+ echo; \
+ echo 'import sys'; \
+ echo 'import $(MODULE) as main'; \
+ echo; \
+ echo '# Temporarily alias commands until bash completion'; \
+ echo '# generator is changed'; \
+ echo 'if hasattr(main, "commands"):'; \
+ echo ' commands = main.commands # pylint: disable-msg=E1101'; \
+ echo; \
+ echo 'if __name__ == "__main__":'; \
+ echo ' sys.exit(main.Main())'; \
+ } > $@
+ chmod u+x $@
+