The text for each forwarder is largely the same, though the qom-fuse stub instructs users to install the optional fuse dependency for the qemu package.
Signed-off-by: John Snow <js...@redhat.com> --- scripts/qmp/qemu-ga-client | 40 ++++++++++++++++++++++++++++++++----- scripts/qmp/qom-fuse | 40 ++++++++++++++++++++++++++++++++----- scripts/qmp/qom-get | 40 ++++++++++++++++++++++++++++++++----- scripts/qmp/qom-list | 40 ++++++++++++++++++++++++++++++++----- scripts/qmp/qom-set | 40 ++++++++++++++++++++++++++++++++----- scripts/qmp/qom-tree | 41 +++++++++++++++++++++++++++++++++----- 6 files changed, 211 insertions(+), 30 deletions(-) diff --git a/scripts/qmp/qemu-ga-client b/scripts/qmp/qemu-ga-client index 56edd0234a..f9c4087a56 100755 --- a/scripts/qmp/qemu-ga-client +++ b/scripts/qmp/qemu-ga-client @@ -1,11 +1,41 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils import qemu_ga_client +try: + from qemu.utils import qemu_ga_client + _HAVE_DEPS = True +except ModuleNotFoundError: + _HAVE_DEPS = False +bold = "\033[1m" +end = "\033[0m" +cmd = 'qemu-ga-client' -if __name__ == '__main__': - sys.exit(qemu_ga_client.main()) +EMSG = f""" +{bold}'{sys.argv[0]}' is just a forwarder, and is not necessary.{end} + +However, there are missing dependencies to run this script. + +To use the '{cmd}' command directly from the installed package, +install the python package and then add (for a --user install) +~/.local/bin/ to $PATH if it isn't already. Then, you should have access +to the '{cmd}' command. + +For more information, please see ../../python/README.rst. + +maybe: + > cd ../../python/ + > pip3 install --user . + > export PATH=$PATH:~/.local/bin/ + > {cmd} --help + +Alternatively, after installing the qemu package, this forwarder +will work again. However, it will eventually be removed. I apologize for +the inconvenience!""" + +if not _HAVE_DEPS: + print(EMSG, file=sys.stderr) + sys.exit(1) + +sys.exit(qemu_ga_client.main()) diff --git a/scripts/qmp/qom-fuse b/scripts/qmp/qom-fuse index d453807b27..e9edf01550 100755 --- a/scripts/qmp/qom-fuse +++ b/scripts/qmp/qom-fuse @@ -1,11 +1,41 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom_fuse import QOMFuse +try: + from qemu.utils.qom_fuse import QOMFuse + _HAVE_DEPS = True +except ModuleNotFoundError: + _HAVE_DEPS = False +bold = "\033[1m" +end = "\033[0m" +cmd = 'qom-fuse' -if __name__ == '__main__': - sys.exit(QOMFuse.entry_point()) +EMSG = f""" +{bold}'{sys.argv[0]}' is just a forwarder, and is not necessary.{end} + +However, there are missing dependencies to run this script. + +To use the '{cmd}' command directly from the installed package, +install the python package and then add (for a --user install) +~/.local/bin/ to $PATH if it isn't already. Then, you should have access +to the '{cmd}' command. + +For more information, please see ../../python/README.rst. + +maybe: + > cd ../../python/ + > pip3 install --user .[fuse] + > export PATH=$PATH:~/.local/bin/ + > {cmd} --help + +Alternatively, after installing the qemu[fuse] package, this forwarder +will work again. However, it will eventually be removed. I apologize for +the inconvenience!""" + +if not _HAVE_DEPS: + print(EMSG, file=sys.stderr) + sys.exit(1) + +sys.exit(QOMFuse.entry_point()) diff --git a/scripts/qmp/qom-get b/scripts/qmp/qom-get index 04ebe052e8..9fa3e1c270 100755 --- a/scripts/qmp/qom-get +++ b/scripts/qmp/qom-get @@ -1,11 +1,41 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMGet +try: + from qemu.utils.qom import QOMGet + _HAVE_DEPS = True +except ModuleNotFoundError: + _HAVE_DEPS = False +bold = "\033[1m" +end = "\033[0m" +cmd = 'qom-get' -if __name__ == '__main__': - sys.exit(QOMGet.entry_point()) +EMSG = f""" +{bold}'{sys.argv[0]}' is just a forwarder, and is not necessary.{end} + +However, there are missing dependencies to run this script. + +To use the '{cmd}' command directly from the installed package, +install the python package and then add (for a --user install) +~/.local/bin/ to $PATH if it isn't already. Then, you should have access +to the '{cmd}' command. + +For more information, please see ../../python/README.rst. + +maybe: + > cd ../../python/ + > pip3 install --user . + > export PATH=$PATH:~/.local/bin/ + > {cmd} --help + +Alternatively, after installing the qemu package, this forwarder +will work again. However, it will eventually be removed. I apologize for +the inconvenience!""" + +if not _HAVE_DEPS: + print(EMSG, file=sys.stderr) + sys.exit(1) + +sys.exit(QOMGet.entry_point()) diff --git a/scripts/qmp/qom-list b/scripts/qmp/qom-list index 853b85a8d3..6c6e4074e9 100755 --- a/scripts/qmp/qom-list +++ b/scripts/qmp/qom-list @@ -1,11 +1,41 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMList +try: + from qemu.utils.qom import QOMList + _HAVE_DEPS = True +except ModuleNotFoundError: + _HAVE_DEPS = False +bold = "\033[1m" +end = "\033[0m" +cmd = 'qom-list' -if __name__ == '__main__': - sys.exit(QOMList.entry_point()) +EMSG = f""" +{bold}'{sys.argv[0]}' is just a forwarder, and is not necessary.{end} + +However, there are missing dependencies to run this script. + +To use the '{cmd}' command directly from the installed package, +install the python package and then add (for a --user install) +~/.local/bin/ to $PATH if it isn't already. Then, you should have access +to the '{cmd}' command. + +For more information, please see ../../python/README.rst. + +maybe: + > cd ../../python/ + > pip3 install --user . + > export PATH=$PATH:~/.local/bin/ + > {cmd} --help + +Alternatively, after installing the qemu package, this forwarder +will work again. However, it will eventually be removed. I apologize for +the inconvenience!""" + +if not _HAVE_DEPS: + print(EMSG, file=sys.stderr) + sys.exit(1) + +sys.exit(QOMList.entry_point()) diff --git a/scripts/qmp/qom-set b/scripts/qmp/qom-set index 06820feec4..bcdee0e2d5 100755 --- a/scripts/qmp/qom-set +++ b/scripts/qmp/qom-set @@ -1,11 +1,41 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMSet +try: + from qemu.utils.qom import QOMSet + _HAVE_DEPS = True +except ModuleNotFoundError: + _HAVE_DEPS = False +bold = "\033[1m" +end = "\033[0m" +cmd = 'qom-set' -if __name__ == '__main__': - sys.exit(QOMSet.entry_point()) +EMSG = f""" +{bold}'{sys.argv[0]}' is just a forwarder, and is not necessary.{end} + +However, there are missing dependencies to run this script. + +To use the '{cmd}' command directly from the installed package, +install the python package and then add (for a --user install) +~/.local/bin/ to $PATH if it isn't already. Then, you should have access +to the '{cmd}' command. + +For more information, please see ../../python/README.rst. + +maybe: + > cd ../../python/ + > pip3 install --user . + > export PATH=$PATH:~/.local/bin/ + > {cmd} --help + +Alternatively, after installing the qemu package, this forwarder +will work again. However, it will eventually be removed. I apologize for +the inconvenience!""" + +if not _HAVE_DEPS: + print(EMSG, file=sys.stderr) + sys.exit(1) + +sys.exit(QOMSet.entry_point()) diff --git a/scripts/qmp/qom-tree b/scripts/qmp/qom-tree index 760e172277..c9c1247f18 100755 --- a/scripts/qmp/qom-tree +++ b/scripts/qmp/qom-tree @@ -1,11 +1,42 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMTree +try: + from qemu.utils.qom import QOMTree + _HAVE_DEPS = True +except ModuleNotFoundError: + _HAVE_DEPS = False +bold = "\033[1m" +end = "\033[0m" +cmd = 'qom-tree' -if __name__ == '__main__': - sys.exit(QOMTree.entry_point()) +EMSG = f""" +{bold}'{sys.argv[0]}' is just a forwarder, and is not necessary.{end} + +However, there are missing dependencies to run this script. + +To use the '{cmd}' command directly from the installed package, +install the python package and then add (for a --user install) +~/.local/bin/ to $PATH if it isn't already. Then, you should have access +to the '{cmd}' command. + +For more information, please see ../../python/README.rst. + +maybe: + > cd ../../python/ + > pip3 install --user . + > export PATH=$PATH:~/.local/bin/ + > {cmd} --help + +Alternatively, after installing the qemu package, this forwarder +will work again. However, it will eventually be removed. I apologize for +the inconvenience!""" + +if not _HAVE_DEPS: + print(EMSG, file=sys.stderr) + sys.exit(1) + +sys.exit(QOMTree.entry_point()) +k -- 2.31.1