generated from datalad/datalad-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #669 from christian-monch/patch-create-sibling-ria
Patch RIA and ORA code to work on multiple client platforms
- Loading branch information
Showing
16 changed files
with
3,344 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
froms=ds.repo.get_revisions()[1], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
changelog.d/20240514_212532_michael.hanke_patch_create_sibling_ria.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
### 💫 Enhancements and new features | ||
|
||
- A large 3k-line patch set replaces almost the entire RIA implementation, | ||
including the ORA special remote, and the `create-sibling-ria` command. | ||
The new implementation brings uniform support for Windows clients, progress | ||
reporting for uploads and downloads via SSH, and a faster and more | ||
robust behavior for SSH-based operations (based on the new remote | ||
shell feature). | ||
Fixes https://github.com/datalad/datalad-next/issues/654 via | ||
https://github.com/datalad/datalad-next/pull/669 (by @christian-monch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
"""Add the method :meth:`url2transport_path` to RIA IO-abstraction classes | ||
This patch adds the method :meth:`url2transport_path` to the IO-abstraction | ||
classes: :class:`datalad.distributed.ora_remote.LocalIO`, and to the class | ||
:class:`datalad.distributed.ora_remote.HTTPRemoteIO`. | ||
This method is required by the patches that add Windows-client support to | ||
RIA-code. It converts internally used abstract paths to concrete paths that are | ||
platform- andIO-abstraction specific and on which IO-operations cam be | ||
performed. | ||
""" | ||
from __future__ import annotations | ||
|
||
import logging | ||
from re import compile | ||
from pathlib import ( | ||
Path, | ||
PurePosixPath, | ||
) | ||
|
||
from datalad_next.consts import on_windows | ||
from . import apply_patch | ||
|
||
|
||
# The methods are patched into the ora_remote/ria_remote. Use the same logger. | ||
lgr = logging.getLogger('datalad.customremotes.ria_remote') | ||
|
||
|
||
drive_letter_matcher = compile('^/[A-Z]:') | ||
|
||
|
||
def str2windows_path(url_path: PurePosixPath): | ||
path_str = str(url_path) | ||
match = drive_letter_matcher.match(path_str) | ||
if match: | ||
if path_str[3] == '/': | ||
return Path(*([f'{path_str[1]}:', '/'] + path_str[4:].split('/'))) | ||
else: | ||
lgr.warning(f'Non-absolute Windows-path detected: {path_str}') | ||
return Path(*([f'{path_str[1]}:'] + path_str[3:].split('/'))) | ||
else: | ||
return Path(path_str) | ||
|
||
|
||
def local_io_url2transport_path( | ||
self, | ||
url_path: PurePosixPath | ||
) -> Path | PurePosixPath: | ||
assert url_path.__class__ is PurePosixPath | ||
if on_windows: | ||
return str2windows_path(url_path) | ||
else: | ||
return Path(url_path) | ||
|
||
|
||
def http_remote_io_url2transport_path( | ||
self, | ||
url_path: PurePosixPath | ||
) -> Path | PurePosixPath: | ||
assert url_path.__class__ is PurePosixPath | ||
return url_path | ||
|
||
|
||
# Add a `url2transport_path`-method to `ora_remote.LocalIO` | ||
apply_patch( | ||
'datalad.distributed.ora_remote', | ||
'LocalIO', | ||
'url2transport_path', | ||
local_io_url2transport_path, | ||
expect_attr_present=False, | ||
) | ||
|
||
|
||
# Add a `url2transport_path`-method to `ora_remote.HTTPRemoteIO` | ||
apply_patch( | ||
'datalad.distributed.ora_remote', | ||
'HTTPRemoteIO', | ||
'url2transport_path', | ||
http_remote_io_url2transport_path, | ||
expect_attr_present=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.