diff --git a/scripts/Makefile b/scripts/Makefile index 17c8e383fac..8f07e91efe7 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -177,6 +177,7 @@ endif sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/python3/' $(DESTDIR)$(SITE3_DIR)/XenAPIPlugin.py $(IDATA) examples/python/XenAPI/XenAPI.py $(DESTDIR)$(SITE3_DIR)/ $(IDATA) examples/python/inventory.py $(DESTDIR)$(SITE3_DIR)/ + $(IDATA) observer.py $(DESTDIR)$(SITE3_DIR)/ $(IPROG) examples/python/echo.py $(DESTDIR)$(PLUGINDIR)/echo $(IPROG) examples/python/shell.py $(DESTDIR)$(LIBEXECDIR)/shell.py # poweron diff --git a/scripts/observer.py b/scripts/observer.py new file mode 100644 index 00000000000..96013361866 --- /dev/null +++ b/scripts/observer.py @@ -0,0 +1,15 @@ +#!/usr/bin/python3 + +if __name__ == '__main__': + # run a program passed as parameter, with its original arguments + import runpy + import sys + + # shift all the argvs one left + sys.argv = sys.argv[1:] + argv0=sys.argv[0] + + def run(file): + runpy.run_path(file, run_name='__main__') + + run(argv0)