From: Johannes Berg Date: Mon, 3 Jan 2022 18:41:59 +0000 (+0100) Subject: fuse: detect fusepy module X-Git-Url: https://arthur.ath.cx/gitweb/?a=commitdiff_plain;h=b7c608ddc2a1308a94f3e6a5893df1f141343a76;p=bup.git fuse: detect fusepy module When importing 'fuse', we might get either the libfuse or the fusepy module, the latter doesn't have __version__ so we just print error: fuse module is too old for fuse.__version__ but that's misleading. Detect if we have fuse.FUSE and in that case instead print error: fuse module appears to be fusepy, not python-fuse please install https://github.com/libfuse/python-fuse Signed-off-by: Johannes Berg Reviewed-by: Rob Browning [rlb@defaultvalue.org: adjust commit message and error messages] Signed-off-by: Rob Browning Tested-by: Rob Browning --- diff --git a/lib/bup/cmd/fuse.py b/lib/bup/cmd/fuse.py index 2793712..78073ee 100644 --- a/lib/bup/cmd/fuse.py +++ b/lib/bup/cmd/fuse.py @@ -9,7 +9,13 @@ except ImportError: file=sys.stderr) sys.exit(2) if not hasattr(fuse, '__version__'): - print('error: fuse module is too old for fuse.__version__', file=sys.stderr) + if hasattr(fuse, 'FUSE'): + print('error: python fuse module appears to be fusepy, not python-fuse\n' + ' please install https://github.com/libfuse/python-fuse', + file=sys.stderr) + else: + print('error: fuse module may need to be upgraded (no fuse.__version__)', + file=sys.stderr) sys.exit(2) fuse.fuse_python_api = (0, 2)