diff --git a/core/ratarmountcore/factory.py b/core/ratarmountcore/factory.py index 414f97a5..4871b1fd 100644 --- a/core/ratarmountcore/factory.py +++ b/core/ratarmountcore/factory.py @@ -127,6 +127,9 @@ class FixedSSHFileSystem(SSHFileSystem): def openFsspec(url, options, printDebug: int) -> Optional[Union[MountSource, IO[bytes], str]]: + if not fsspec: + return None + splitURI = url.split('://', 1) protocol = splitURI[0] if len(splitURI) > 1 else '' if not protocol: @@ -135,11 +138,6 @@ def openFsspec(url, options, printDebug: int) -> Optional[Union[MountSource, IO[ if protocol == 'file': return splitURI[1] - if not fsspec: - print("[Warning] An URL was detected but fsspec is not installed. You may want to install it with:") - print("[Warning] python3 -m pip install ratarmount[fsspec]") - return None - result = None try: if printDebug >= 3: @@ -224,7 +222,7 @@ def newDel(): def openMountSource(fileOrPath: Union[str, IO[bytes]], **options) -> MountSource: printDebug = int(options.get("printDebug", 0)) if isinstance(options.get("printDebug", 0), int) else 0 - if isinstance(fileOrPath, str): + if fsspec and isinstance(fileOrPath, str): result = openFsspec(fileOrPath, options, printDebug=printDebug) if isinstance(result, MountSource): return result diff --git a/ratarmount.py b/ratarmount.py index b6946e2c..d9f5eb3b 100755 --- a/ratarmount.py +++ b/ratarmount.py @@ -1158,12 +1158,6 @@ def _parseArgs(rawArgs: Optional[List[str]] = None): - ratarmount folder1 folder2 mountpoint - ratarmount folder archive.zip folder - ratarmount -o modules=subdir,subdir=squashfs-root archive.squashfs mountpoint - - ratarmount http://server.org:80/archive.rar folder folder - - ratarmount ssh://hostname:22/relativefolder/ mountpoint - - ratarmount ssh://hostname:22//tmp/tmp-abcdef/ mountpoint - - ratarmount github://mxmlnkn:ratarmount@v0.15.2/tests/single-file.tar mountpoint - - AWS_ACCESS_KEY_ID=aaaaaaaaaaaaaaaaaaaa AWS_SECRET_ACCESS_KEY=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb \\ - ratarmount s3://127.0.0.1/bucket/single-file.tar mounted For further information, see the ReadMe on the project's homepage: @@ -1460,9 +1454,8 @@ def _parseArgs(rawArgs: Optional[List[str]] = None): # This is a hack but because we have two positional arguments (and want that reflected in the auto-generated help), # all positional arguments, including the mountpath will be parsed into the tar file path's namespace and we have to # manually separate them depending on the type. - lastArgument = args.mount_source[-1] - if '://' not in lastArgument and (os.path.isdir(lastArgument) or not os.path.exists(lastArgument)): - args.mount_point = lastArgument + if os.path.isdir(args.mount_source[-1]) or not os.path.exists(args.mount_source[-1]): + args.mount_point = args.mount_source[-1] args.mount_source = args.mount_source[:-1] if not args.mount_source and not args.write_overlay: raise argparse.ArgumentTypeError( @@ -1516,8 +1509,6 @@ def checkMountSource(path): args.mount_point = os.path.splitext(args.mount_source[0])[0] else: args.mount_point = autoMountPoint - if '://' in args.mount_point: - args.mount_point = "ratarmount.mounted" args.mount_point = os.path.abspath(args.mount_point) # Preprocess the --index-folders list as a string argument