Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmlnkn committed Oct 6, 2024
1 parent 6a39766 commit e03f6fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
10 changes: 4 additions & 6 deletions core/ratarmountcore/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
13 changes: 2 additions & 11 deletions ratarmount.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]/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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e03f6fd

Please sign in to comment.