From: "Juraj Linkeš" <juraj.linkes@pantheon.tech>
To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com,
paul.szczepanek@arm.com, Luca.Vizzarro@arm.com,
alex.chapman@arm.com, probb@iol.unh.edu, jspewock@iol.unh.edu,
npratte@iol.unh.edu, dmarx@iol.unh.edu
Cc: dev@dpdk.org, "Tomáš Ďurovec" <tomas.durovec@pantheon.tech>
Subject: [RFC PATCH v1 04/12] dts: improve path handling for local and remote paths
Date: Fri, 6 Sep 2024 15:26:48 +0200 [thread overview]
Message-ID: <20240906132656.21729-5-juraj.linkes@pantheon.tech> (raw)
In-Reply-To: <20240906132656.21729-1-juraj.linkes@pantheon.tech>
From: Tomáš Ďurovec <tomas.durovec@pantheon.tech>
Update remote session to clearly differentiate between
local and remote paths. Local paths now accept OS-aware
path objects, while remote paths handle OS-agnostic paths.
Signed-off-by: Tomáš Ďurovec <tomas.durovec@pantheon.tech>
---
dts/framework/remote_session/remote_session.py | 6 +++---
dts/framework/remote_session/ssh_session.py | 6 +++---
dts/framework/testbed_model/os_session.py | 6 +++---
dts/framework/testbed_model/posix_session.py | 6 +++---
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dts/framework/remote_session/remote_session.py b/dts/framework/remote_session/remote_session.py
index 6ca8593c90..ce311e70b6 100644
--- a/dts/framework/remote_session/remote_session.py
+++ b/dts/framework/remote_session/remote_session.py
@@ -12,7 +12,7 @@
from abc import ABC, abstractmethod
from dataclasses import InitVar, dataclass, field
-from pathlib import PurePath
+from pathlib import Path, PurePath
from framework.config import NodeConfiguration
from framework.exception import RemoteCommandExecutionError
@@ -199,7 +199,7 @@ def is_alive(self) -> bool:
def copy_from(
self,
source_file: str | PurePath,
- destination_dir: str | PurePath,
+ destination_dir: str | Path,
) -> None:
"""Copy a file from the remote Node to the local filesystem.
@@ -215,7 +215,7 @@ def copy_from(
@abstractmethod
def copy_to(
self,
- source_file: str | PurePath,
+ source_file: str | Path,
destination_dir: str | PurePath,
) -> None:
"""Copy a file from local filesystem to the remote Node.
diff --git a/dts/framework/remote_session/ssh_session.py b/dts/framework/remote_session/ssh_session.py
index a756bfecef..88a000912e 100644
--- a/dts/framework/remote_session/ssh_session.py
+++ b/dts/framework/remote_session/ssh_session.py
@@ -5,7 +5,7 @@
import socket
import traceback
-from pathlib import PurePath
+from pathlib import Path, PurePath
from fabric import Connection # type: ignore[import-untyped]
from invoke.exceptions import ( # type: ignore[import-untyped]
@@ -106,14 +106,14 @@ def is_alive(self) -> bool:
def copy_from(
self,
source_file: str | PurePath,
- destination_dir: str | PurePath,
+ destination_dir: str | Path,
) -> None:
"""Overrides :meth:`~.remote_session.RemoteSession.copy_from`."""
self.session.get(str(source_file), str(destination_dir))
def copy_to(
self,
- source_file: str | PurePath,
+ source_file: str | Path,
destination_dir: str | PurePath,
) -> None:
"""Overrides :meth:`~.remote_session.RemoteSession.copy_to`."""
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index 8928a47d6f..d24f44df10 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -25,7 +25,7 @@
from abc import ABC, abstractmethod
from collections.abc import Iterable
from ipaddress import IPv4Interface, IPv6Interface
-from pathlib import PurePath
+from pathlib import Path, PurePath
from typing import Union
from framework.config import Architecture, NodeConfiguration, NodeInfo
@@ -181,7 +181,7 @@ def join_remote_path(self, *args: str | PurePath) -> PurePath:
def copy_from(
self,
source_file: str | PurePath,
- destination_dir: str | PurePath,
+ destination_dir: str | Path,
) -> None:
"""Copy a file from the remote node to the local filesystem.
@@ -197,7 +197,7 @@ def copy_from(
@abstractmethod
def copy_to(
self,
- source_file: str | PurePath,
+ source_file: str | Path,
destination_dir: str | PurePath,
) -> None:
"""Copy a file from local filesystem to the remote node.
diff --git a/dts/framework/testbed_model/posix_session.py b/dts/framework/testbed_model/posix_session.py
index 7f0b1f2036..0d8c5f91a6 100644
--- a/dts/framework/testbed_model/posix_session.py
+++ b/dts/framework/testbed_model/posix_session.py
@@ -13,7 +13,7 @@
import re
from collections.abc import Iterable
-from pathlib import PurePath, PurePosixPath
+from pathlib import Path, PurePath, PurePosixPath
from framework.config import Architecture, NodeInfo
from framework.exception import DPDKBuildError, RemoteCommandExecutionError
@@ -88,14 +88,14 @@ def join_remote_path(self, *args: str | PurePath) -> PurePosixPath:
def copy_from(
self,
source_file: str | PurePath,
- destination_dir: str | PurePath,
+ destination_dir: str | Path,
) -> None:
"""Overrides :meth:`~.os_session.OSSession.copy_from`."""
self.remote_session.copy_from(source_file, destination_dir)
def copy_to(
self,
- source_file: str | PurePath,
+ source_file: str | Path,
destination_dir: str | PurePath,
) -> None:
"""Overrides :meth:`~.os_session.OSSession.copy_to`."""
--
2.43.0
next prev parent reply other threads:[~2024-09-06 13:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-06 13:26 [RFC PATCH v1 00/12] DTS external DPDK build and stats Juraj Linkeš
2024-09-06 13:26 ` [RFC PATCH v1 01/12] dts: rename build target to DPDK build Juraj Linkeš
2024-09-06 13:26 ` [RFC PATCH v1 02/12] dts: one dpdk build per test run Juraj Linkeš
2024-09-06 13:26 ` [RFC PATCH v1 03/12] dts: fix remote session transferring files Juraj Linkeš
2024-09-06 13:26 ` Juraj Linkeš [this message]
2024-09-06 13:26 ` [RFC PATCH v1 05/12] dts: add the ability to copy directories via remote Juraj Linkeš
2024-09-06 13:26 ` [RFC PATCH v1 06/12] dts: add ability to prevent overwriting files/dirs Juraj Linkeš
2024-09-06 13:26 ` [RFC PATCH v1 07/12] dts: update argument option for prevent overwriting Juraj Linkeš
2024-09-06 13:26 ` [RFC PATCH v1 08/12] dts: add support for externally compiled DPDK Juraj Linkeš
2024-09-06 13:26 ` [RFC PATCH v1 09/12] doc: update argument options for external DPDK build Juraj Linkeš
2024-09-06 13:26 ` [RFC PATCH v1 10/12] dts: remove git ref option Juraj Linkeš
2024-09-06 13:26 ` [RFC PATCH v1 11/12] doc: remove git-ref argument Juraj Linkeš
2024-09-06 13:26 ` [RFC PATCH v1 12/12] dts: improve statistics Juraj Linkeš
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240906132656.21729-5-juraj.linkes@pantheon.tech \
--to=juraj.linkes@pantheon.tech \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=Luca.Vizzarro@arm.com \
--cc=alex.chapman@arm.com \
--cc=dev@dpdk.org \
--cc=dmarx@iol.unh.edu \
--cc=jspewock@iol.unh.edu \
--cc=npratte@iol.unh.edu \
--cc=paul.szczepanek@arm.com \
--cc=probb@iol.unh.edu \
--cc=thomas@monjalon.net \
--cc=tomas.durovec@pantheon.tech \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).