diff --git a/setup.cfg b/setup.cfg index 643f2fd..d6a6355 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,7 +15,7 @@ classifiers = [options] install_requires = fsspec>=2021.8.1 - asyncssh>=2.11.0,<3 + asyncssh==2.19.0 packages = find: [options.extras_require] diff --git a/sshfs/config.py b/sshfs/config.py index cf73c64..e84706c 100644 --- a/sshfs/config.py +++ b/sshfs/config.py @@ -1,29 +1,44 @@ import getpass from contextlib import suppress from pathlib import Path +import asyncssh from asyncssh.config import SSHClientConfig SSH_CONFIG = Path("~", ".ssh", "config").expanduser() -def parse_config( - *, host, user=(), port=(), local_user=None, config_files=None -): +def parse_config(*, host, user=(), port=(), local_user=None, config_files=None): if config_files is None: config_files = [SSH_CONFIG] if local_user is None: - with suppress(KeyError): + with suppress(OSError): # Use OSError as getuser() might raise this. local_user = getpass.getuser() last_config = None reload = False - return SSHClientConfig.load( + # Check asyncssh version + version = tuple(map(int, asyncssh.__version__.split("."))) + if version <= (2, 18, 0): # Compare version properly + return SSHClientConfig.load( + last_config, + config_files, + reload, + local_user, + user, + host, + port, + ) + canonical = False # Fixed typo + final = False # Fixed typo + return SSHClientConfig.load( last_config, config_files, reload, + canonical, # Use correct parameter + final, # Use correct parameter local_user, user, host,