python3Packages.rclone-python: hardcode path to rclone executable

This commit is contained in:
Robert Schütz 2025-07-14 13:58:10 -07:00
parent 0455292066
commit 44c0690eb7
2 changed files with 106 additions and 1 deletions

View File

@ -2,6 +2,7 @@
lib,
buildPythonPackage,
fetchFromGitHub,
replaceVars,
setuptools,
rich,
rclone,
@ -19,10 +20,15 @@ buildPythonPackage rec {
hash = "sha256-vvsiXS3uI0TcL+X8+75BQmycrF+EGIgQE1dmGef35rI=";
};
patches = [
(replaceVars ./hardcode-rclone-path.patch {
rclone = lib.getExe rclone;
})
];
build-system = [ setuptools ];
dependencies = [
rclone
rich
];

View File

@ -0,0 +1,99 @@
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)