Move qom-fuse over to the python package now that it passes the linter. Update the import paradigms so that it passes.
Immediately add 'fusepy' to the development requirements and re-lock the pipenv so that the test suite continues to pass. Signed-off-by: John Snow <js...@redhat.com> --- python/Pipfile.lock | 13 ++++++++++--- scripts/qmp/qom-fuse => python/qemu/qmp/qom_fuse.py | 12 ++---------- python/setup.cfg | 1 + 3 files changed, 13 insertions(+), 13 deletions(-) rename scripts/qmp/qom-fuse => python/qemu/qmp/qom_fuse.py (95%) mode change 100755 => 100644 diff --git a/python/Pipfile.lock b/python/Pipfile.lock index 0352a628ef6f..d1e56cbcafc6 100644 --- a/python/Pipfile.lock +++ b/python/Pipfile.lock @@ -46,6 +46,12 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==3.8.4" }, + "fusepy": { + "hashes": [ + "sha256:72ff783ec2f43de3ab394e3f7457605bf04c8cf288a2f4068b4cde141d4ee6bd" + ], + "version": "==3.0.1" + }, "importlib-metadata": { "hashes": [ "sha256:77a540690e24b0305878c37ffd421785a6f7e53c8b5720d211b211de8d0e95da", @@ -208,10 +214,11 @@ }, "toml": { "hashes": [ - "sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f", - "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88" + "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", + "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f" ], - "version": "==0.10.1" + "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'", + "version": "==0.10.2" }, "typed-ast": { "hashes": [ diff --git a/scripts/qmp/qom-fuse b/python/qemu/qmp/qom_fuse.py old mode 100755 new mode 100644 similarity index 95% rename from scripts/qmp/qom-fuse rename to python/qemu/qmp/qom_fuse.py index 22be36634967..b0adcc1f8e62 --- a/scripts/qmp/qom-fuse +++ b/python/qemu/qmp/qom_fuse.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 """ QEMU Object Model FUSE filesystem tool @@ -36,7 +35,6 @@ import argparse from errno import ENOENT, EPERM -import os import stat import sys from typing import ( @@ -51,10 +49,8 @@ import fuse from fuse import FUSE, FuseOSError, Operations - -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.qmp import QMPResponseError -from qemu.qmp.qom_common import QOMCommand +from . import QMPResponseError +from .qom_common import QOMCommand fuse.fuse_python_api = (0, 2) @@ -209,7 +205,3 @@ def readdir(self, path: str, fh: IO[bytes]) -> Iterator[str]: yield '..' for item in self.qom_list(path): yield item.name - - -if __name__ == '__main__': - sys.exit(QOMFuse.entry_point()) diff --git a/python/setup.cfg b/python/setup.cfg index 831555552f16..a9a76784d45a 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -27,6 +27,7 @@ devel = mypy >= 0.770 pylint >= 2.6.0 pytest >= 3.0.0 + fusepy >= 2.0.4 [options.entry_points] console_scripts = -- 2.26.2