diff --git a/python3/Makefile b/python3/Makefile index e86d5c683c3..2d27b6694fb 100644 --- a/python3/Makefile +++ b/python3/Makefile @@ -17,6 +17,7 @@ install: $(IPROG) libexec/usb_reset.py $(DESTDIR)$(LIBEXECDIR) $(IPROG) libexec/usb_scan.py $(DESTDIR)$(LIBEXECDIR) $(IPROG) libexec/nbd_client_manager.py $(DESTDIR)$(LIBEXECDIR) + $(IPROG) libexec/probe-device-for-file $(DESTDIR)$(LIBEXECDIR) $(IPROG) bin/hfx_filename $(DESTDIR)$(OPTDIR)/bin $(IPROG) bin/perfmon $(DESTDIR)$(OPTDIR)/bin diff --git a/scripts/probe-device-for-file b/python3/libexec/probe-device-for-file similarity index 87% rename from scripts/probe-device-for-file rename to python3/libexec/probe-device-for-file index be07f40758f..46882c2cbec 100755 --- a/scripts/probe-device-for-file +++ b/python3/libexec/probe-device-for-file @@ -2,13 +2,16 @@ # (c) Anil Madhavapeddy, Citrix Systems Inc, 2008 # Checks for the existence of a file on a device -import os, sys +import os +import sys + try: - import xenfsimage + import xenfsimage except ImportError: - import fsimage as xenfsimage + import fsimage as xenfsimage from contextlib import contextmanager + # https://stackoverflow.com/a/17954769 @contextmanager def stderr_redirected(to=os.devnull): @@ -33,7 +36,7 @@ def stderr_redirected(to=os.devnull): with open(to, 'w') as file: _redirect_stderr(to=file) try: - yield # allow code to be run with the redirected stderr + yield # allow code to be run with the redirected stderr finally: _redirect_stderr(to=old_stderr) # restore stderr. # buffering and flags such as @@ -41,8 +44,8 @@ def stderr_redirected(to=os.devnull): if __name__ == "__main__": if len(sys.argv) != 3: - print("Usage: %s " % sys.argv[0]) - sys.exit(2) + print("Usage: %s " % sys.argv[0]) + sys.exit(2) device = sys.argv[1] file = sys.argv[2] try: diff --git a/scripts/Makefile b/scripts/Makefile index 5700d4bd879..5e00c11dfea 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -117,7 +117,6 @@ install: $(IPROG) print-custom-templates $(DESTDIR)$(LIBEXECDIR) $(IPROG) backup-sr-metadata.py $(DESTDIR)$(LIBEXECDIR) $(IPROG) restore-sr-metadata.py $(DESTDIR)$(LIBEXECDIR) - $(IPROG) probe-device-for-file $(DESTDIR)$(LIBEXECDIR) $(IPROG) backup-metadata-cron $(DESTDIR)$(LIBEXECDIR) $(IPROG) pbis-force-domain-leave $(DESTDIR)$(LIBEXECDIR) mkdir -p $(DESTDIR)/etc/sysconfig