nixpkgs/pkgs/development/python-modules/rclone-python/hardcode-rclone-path.patch
2025-07-14 14:29:54 -07:00

130 lines
4.5 KiB
Diff

diff --git a/rclone_python/rclone.py b/rclone_python/rclone.py
index da399b4..e05365a 100644
--- a/rclone_python/rclone.py
+++ b/rclone_python/rclone.py
@@ -43,7 +43,7 @@ def is_installed() -> bool:
"""
:return: True if rclone is correctly installed on the system.
"""
- return which("rclone") is not None
+ return True
@__check_installed
@@ -199,7 +199,7 @@ def copy(
in_path,
out_path,
ignore_existing=ignore_existing,
- command="rclone copy",
+ command="@rclone@ copy",
command_descr="Copying",
show_progress=show_progress,
listener=listener,
@@ -234,7 +234,7 @@ def copyto(
in_path,
out_path,
ignore_existing=ignore_existing,
- command="rclone copyto",
+ command="@rclone@ copyto",
command_descr="Copying",
show_progress=show_progress,
listener=listener,
@@ -269,7 +269,7 @@ def move(
in_path,
out_path,
ignore_existing=ignore_existing,
- command="rclone move",
+ command="@rclone@ move",
command_descr="Moving",
show_progress=show_progress,
listener=listener,
@@ -304,7 +304,7 @@ def moveto(
in_path,
out_path,
ignore_existing=ignore_existing,
- command="rclone moveto",
+ command="@rclone@ moveto",
command_descr="Moving",
show_progress=show_progress,
listener=listener,
@@ -336,7 +336,7 @@ def sync(
_rclone_transfer_operation(
src_path,
dest_path,
- command="rclone sync",
+ command="@rclone@ sync",
command_descr="Syncing",
show_progress=show_progress,
listener=listener,
diff --git a/rclone_python/scripts/get_version.py b/rclone_python/scripts/get_version.py
index b1d30fd..bc00cad 100644
--- a/rclone_python/scripts/get_version.py
+++ b/rclone_python/scripts/get_version.py
@@ -2,6 +2,6 @@ from subprocess import check_output
def get_version():
- stdout = check_output("rclone version", shell=True, encoding="utf8")
+ stdout = check_output("@rclone@ version", shell=True, encoding="utf8")
return stdout.split("\n")[0].replace("rclone ", "")
diff --git a/rclone_python/scripts/update_hash_types.py b/rclone_python/scripts/update_hash_types.py
index 92fbd0a..ef963cf 100644
--- a/rclone_python/scripts/update_hash_types.py
+++ b/rclone_python/scripts/update_hash_types.py
@@ -14,7 +14,7 @@ def update_hashes(output_path: str):
"""
# get all supported backends
- rclone_output = sp.check_output("rclone hashsum", shell=True, encoding="utf8")
+ rclone_output = sp.check_output("@rclone@ hashsum", shell=True, encoding="utf8")
lines = rclone_output.splitlines()
hashes = []
diff --git a/rclone_python/utils.py b/rclone_python/utils.py
index d4a8413..1b29bd8 100644
--- a/rclone_python/utils.py
+++ b/rclone_python/utils.py
@@ -66,9 +66,9 @@ def run_rclone_cmd(
# otherwise the default rclone config path is used:
config = Config()
if config.config_path is not None:
- base_command = f"rclone --config={config.config_path}"
+ base_command = f"@rclone@ --config={config.config_path}"
else:
- base_command = "rclone"
+ base_command = "@rclone@"
# add optional arguments and flags to the command
args_str = args2string(args)
diff --git a/tests/test_copy.py b/tests/test_copy.py
index 4ded5fa..1cae53b 100644
--- a/tests/test_copy.py
+++ b/tests/test_copy.py
@@ -45,11 +45,11 @@ def create_local_file(
@pytest.mark.parametrize(
"wrapper_command,rclone_command",
[
- (rclone.copy, "rclone copy"),
- (rclone.copyto, "rclone copyto"),
- (rclone.sync, "rclone sync"),
- (rclone.move, "rclone move"),
- (rclone.moveto, "rclone moveto"),
+ (rclone.copy, "@rclone@ copy"),
+ (rclone.copyto, "@rclone@ copyto"),
+ (rclone.sync, "@rclone@ sync"),
+ (rclone.move, "@rclone@ move"),
+ (rclone.moveto, "@rclone@ moveto"),
],
)
def test_rclone_command_called(wrapper_command: Callable, rclone_command: str):
@@ -62,7 +62,7 @@ def test_rclone_command_called(wrapper_command: Callable, rclone_command: str):
rclone.utils.subprocess,
"Popen",
return_value=subprocess.Popen(
- "rclone help", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
+ "@rclone@ help", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
),
) as mock:
wrapper_command("nothing/not_a.file", "fake_remote:unicorn/folder")