rclone-api 1.5.46__py3-none-any.whl → 1.5.48__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rclone_api/config.py +9 -6
- rclone_api/install.py +41 -12
- {rclone_api-1.5.46.dist-info → rclone_api-1.5.48.dist-info}/METADATA +1 -1
- {rclone_api-1.5.46.dist-info → rclone_api-1.5.48.dist-info}/RECORD +8 -8
- {rclone_api-1.5.46.dist-info → rclone_api-1.5.48.dist-info}/WHEEL +0 -0
- {rclone_api-1.5.46.dist-info → rclone_api-1.5.48.dist-info}/entry_points.txt +0 -0
- {rclone_api-1.5.46.dist-info → rclone_api-1.5.48.dist-info}/licenses/LICENSE +0 -0
- {rclone_api-1.5.46.dist-info → rclone_api-1.5.48.dist-info}/top_level.txt +0 -0
rclone_api/config.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import os
|
2
|
+
import shutil
|
2
3
|
from dataclasses import dataclass, field
|
3
4
|
from pathlib import Path
|
4
5
|
from typing import Any, Dict, List
|
@@ -89,14 +90,16 @@ def find_conf_file(rclone: Any | None = None) -> Path | None:
|
|
89
90
|
return conf
|
90
91
|
|
91
92
|
if rclone is None:
|
92
|
-
|
93
|
+
has_rclone = shutil.which("rclone")
|
94
|
+
if not has_rclone:
|
95
|
+
from rclone_api.install import rclone_download
|
93
96
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
+
err = rclone_download(Path("."))
|
98
|
+
if isinstance(err, Exception):
|
99
|
+
import warnings
|
97
100
|
|
98
|
-
|
99
|
-
|
101
|
+
warnings.warn(f"rclone_download failed: {err}")
|
102
|
+
return None
|
100
103
|
cmd_list: list[str] = [
|
101
104
|
"rclone",
|
102
105
|
"config",
|
rclone_api/install.py
CHANGED
@@ -79,31 +79,60 @@ def _move_to_standard_linux_paths(exe_path: Path) -> None:
|
|
79
79
|
return
|
80
80
|
|
81
81
|
try:
|
82
|
-
#
|
83
|
-
|
82
|
+
# Try system-wide installation first
|
83
|
+
system_bin_path = Path("/usr/local/bin/rclone")
|
84
84
|
|
85
85
|
if os.access("/usr/local/bin", os.W_OK):
|
86
86
|
# Remove existing binary if it exists
|
87
|
-
if
|
88
|
-
if
|
89
|
-
|
87
|
+
if system_bin_path.exists():
|
88
|
+
if system_bin_path.is_symlink():
|
89
|
+
system_bin_path.unlink()
|
90
90
|
else:
|
91
|
-
os.remove(
|
91
|
+
os.remove(system_bin_path)
|
92
92
|
|
93
93
|
# Move the binary to standard path
|
94
|
-
shutil.move(str(exe_path), str(
|
94
|
+
shutil.move(str(exe_path), str(system_bin_path))
|
95
95
|
|
96
96
|
# Make it executable
|
97
|
-
os.chmod(
|
97
|
+
os.chmod(system_bin_path, 0o755)
|
98
98
|
|
99
99
|
# Create a symlink in the original location
|
100
|
-
exe_path.symlink_to(
|
100
|
+
exe_path.symlink_to(system_bin_path)
|
101
101
|
|
102
|
-
logger.info(
|
102
|
+
logger.info(
|
103
|
+
f"Moved rclone to {system_bin_path} and created symlink at {exe_path}"
|
104
|
+
)
|
103
105
|
else:
|
104
|
-
|
105
|
-
|
106
|
+
# Fall back to user's home directory if no root access
|
107
|
+
home_bin_dir = Path.home() / ".local" / "bin"
|
108
|
+
home_bin_dir.mkdir(parents=True, exist_ok=True)
|
109
|
+
home_bin_path = home_bin_dir / "rclone"
|
110
|
+
|
111
|
+
# Remove existing binary if it exists
|
112
|
+
if home_bin_path.exists():
|
113
|
+
if home_bin_path.is_symlink():
|
114
|
+
home_bin_path.unlink()
|
115
|
+
else:
|
116
|
+
os.remove(home_bin_path)
|
117
|
+
|
118
|
+
# Move the binary to user's bin directory
|
119
|
+
shutil.move(str(exe_path), str(home_bin_path))
|
120
|
+
|
121
|
+
# Make it executable
|
122
|
+
os.chmod(home_bin_path, 0o755)
|
123
|
+
|
124
|
+
# Create a symlink in the original location
|
125
|
+
exe_path.symlink_to(home_bin_path)
|
126
|
+
|
127
|
+
logger.info(
|
128
|
+
f"Moved rclone to {home_bin_path} and created symlink at {exe_path}"
|
106
129
|
)
|
130
|
+
|
131
|
+
# Check if ~/.local/bin is in PATH, if not suggest adding it
|
132
|
+
if str(home_bin_dir) not in os.environ.get("PATH", ""):
|
133
|
+
logger.warning(
|
134
|
+
f"{home_bin_dir} is not in PATH. Consider adding it to your shell profile."
|
135
|
+
)
|
107
136
|
except Exception as e:
|
108
137
|
logger.warning(f"Failed to move rclone to standard paths: {e}")
|
109
138
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
rclone_api/__init__.py,sha256=KxOU2UGnoqw1EDHwugFTHHgccfhq22trGiRDwX5Dsng,34086
|
2
2
|
rclone_api/cli.py,sha256=dibfAZIh0kXWsBbfp3onKLjyZXo54mTzDjUdzJlDlWo,231
|
3
3
|
rclone_api/completed_process.py,sha256=_IZ8IWK7DM1_tsbDEkH6wPZ-bbcrgf7A7smls854pmg,1775
|
4
|
-
rclone_api/config.py,sha256=
|
4
|
+
rclone_api/config.py,sha256=DEBubN0ziUfAFYe6cmDn7YoTqRJPdGronFyRHZvWUso,6070
|
5
5
|
rclone_api/convert.py,sha256=Mx9Qo7zhkOedJd8LdhPvNGHp8znJzOk4f_2KWnoGc78,1012
|
6
6
|
rclone_api/deprecated.py,sha256=qWKpnZdYcBK7YQZKuVoWWXDwi-uqiAtbjgPcci_efow,590
|
7
7
|
rclone_api/diff.py,sha256=tMoJMAGmLSE6Q_7QhPf6PnCzb840djxMZtDmhc2GlGQ,5227
|
@@ -16,7 +16,7 @@ rclone_api/filelist.py,sha256=xbiusvNgaB_b_kQOZoHMJJxn6TWGtPrWd2J042BI28o,767
|
|
16
16
|
rclone_api/fs.py,sha256=xUkoSV2R9dByKgueZ3x2GjyCn9fM7tK1ydgK1Whiph0,8933
|
17
17
|
rclone_api/group_files.py,sha256=H92xPW9lQnbNw5KbtZCl00bD6iRh9yRbCuxku4j_3dg,8036
|
18
18
|
rclone_api/http_server.py,sha256=P-LT2GqCEM9tGbyzzr-CrSOc3FyCw1qXUSQ5bY2KBHU,12113
|
19
|
-
rclone_api/install.py,sha256=
|
19
|
+
rclone_api/install.py,sha256=ZDG8QNj1JciS_DSqYnMTECwhJksUPAoqZQxtX804TDk,5679
|
20
20
|
rclone_api/log.py,sha256=VZHM7pNSXip2ZLBKMP7M1u-rp_F7zoafFDuR8CPUoKI,1271
|
21
21
|
rclone_api/mount.py,sha256=LZqEhuKZunbWVqmsOIqkkCotaxWJpdFRS1InXveoU5E,1428
|
22
22
|
rclone_api/mount_util.py,sha256=jqhJEVTHV6c6lOOzUYb4FLMbqDMHdz7-QRcdH-IobFc,10154
|
@@ -55,9 +55,9 @@ rclone_api/s3/multipart/upload_parts_inline.py,sha256=V7syKjFyVIe4U9Ahl5XgqVTzt9
|
|
55
55
|
rclone_api/s3/multipart/upload_parts_resumable.py,sha256=6-nlMclS8jyVvMvFbQDcZOX9MY1WbCcKA_s9bwuYxnk,9793
|
56
56
|
rclone_api/s3/multipart/upload_parts_server_side_merge.py,sha256=Fp2pdrs5dONQI9LkfNolgAGj1-Z2V1SsRd0r0sreuXI,18040
|
57
57
|
rclone_api/s3/multipart/upload_state.py,sha256=f-Aq2NqtAaMUMhYitlICSNIxCKurWAl2gDEUVizLIqw,6019
|
58
|
-
rclone_api-1.5.
|
59
|
-
rclone_api-1.5.
|
60
|
-
rclone_api-1.5.
|
61
|
-
rclone_api-1.5.
|
62
|
-
rclone_api-1.5.
|
63
|
-
rclone_api-1.5.
|
58
|
+
rclone_api-1.5.48.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
59
|
+
rclone_api-1.5.48.dist-info/METADATA,sha256=oJftVhJmDY8KBcLOlUSGk23lUWpjmRnkOSrpoPuy2GQ,37305
|
60
|
+
rclone_api-1.5.48.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
61
|
+
rclone_api-1.5.48.dist-info/entry_points.txt,sha256=ognh2e11HTjn73_KL5MWI67pBKS2jekBi-QTiRXySXA,316
|
62
|
+
rclone_api-1.5.48.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
|
63
|
+
rclone_api-1.5.48.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|