rclone-api 1.0.30__tar.gz → 1.0.32__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rclone-api might be problematic. Click here for more details.
- {rclone_api-1.0.30 → rclone_api-1.0.32}/PKG-INFO +1 -1
- {rclone_api-1.0.30 → rclone_api-1.0.32}/pyproject.toml +1 -1
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/rclone.py +47 -2
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/util.py +7 -5
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/PKG-INFO +1 -1
- {rclone_api-1.0.30 → rclone_api-1.0.32}/.aiderignore +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/.github/workflows/lint.yml +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/.github/workflows/push_macos.yml +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/.github/workflows/push_ubuntu.yml +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/.github/workflows/push_win.yml +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/.gitignore +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/.pylintrc +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/.vscode/launch.json +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/.vscode/settings.json +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/.vscode/tasks.json +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/LICENSE +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/MANIFEST.in +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/README.md +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/clean +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/install +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/lint +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/requirements.testing.txt +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/setup.cfg +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/setup.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/__init__.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/assets/example.txt +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/cli.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/cmd/list_files.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/config.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/convert.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/diff.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/dir.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/dir_listing.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/exec.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/file.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/filelist.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/process.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/remote.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/rpath.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/walk.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/SOURCES.txt +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/dependency_links.txt +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/entry_points.txt +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/requires.txt +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/top_level.txt +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/test +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_cmd_list_files.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_copy.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_diff.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_is_synced.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_ls.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_mount.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_mount_s3.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_mount_webdav.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_obscure.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_remotes.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_serve_webdav.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_walk.py +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/tox.ini +0 -0
- {rclone_api-1.0.30 → rclone_api-1.0.32}/upload_package.sh +0 -0
@@ -9,6 +9,7 @@ from concurrent.futures import ThreadPoolExecutor
|
|
9
9
|
from enum import Enum
|
10
10
|
from fnmatch import fnmatch
|
11
11
|
from pathlib import Path
|
12
|
+
from tempfile import TemporaryDirectory
|
12
13
|
from typing import Generator
|
13
14
|
|
14
15
|
from rclone_api import Dir
|
@@ -228,8 +229,52 @@ class Rclone:
|
|
228
229
|
) -> subprocess.CompletedProcess:
|
229
230
|
"""Delete a directory"""
|
230
231
|
payload: list[str] = convert_to_filestr_list(files)
|
231
|
-
|
232
|
-
|
232
|
+
if len(payload) == 0:
|
233
|
+
return subprocess.CompletedProcess(
|
234
|
+
args=["rclone", "delete", "--files-from", "[]"],
|
235
|
+
returncode=0,
|
236
|
+
stdout="",
|
237
|
+
stderr="",
|
238
|
+
)
|
239
|
+
|
240
|
+
datalists: dict[str, list[str]] = {}
|
241
|
+
|
242
|
+
for f in payload:
|
243
|
+
remote, path = f.split(":", 1)
|
244
|
+
if "/" in path:
|
245
|
+
bucket, path = path.split("/", 1)
|
246
|
+
remote = f"{remote}:{bucket}"
|
247
|
+
else:
|
248
|
+
remote = f"{remote}:"
|
249
|
+
if remote not in datalists:
|
250
|
+
datalists[remote] = []
|
251
|
+
datalists[remote].append(path)
|
252
|
+
|
253
|
+
out: subprocess.CompletedProcess | None = None
|
254
|
+
|
255
|
+
for remote, files in datalists.items():
|
256
|
+
with TemporaryDirectory() as tmpdir:
|
257
|
+
include_files_txt = Path(tmpdir) / "include_files.txt"
|
258
|
+
include_files_txt.write_text("\n".join(files), encoding="utf-8")
|
259
|
+
|
260
|
+
print(include_files_txt)
|
261
|
+
cmd_list: list[str] = [
|
262
|
+
"delete",
|
263
|
+
remote,
|
264
|
+
"--files-from",
|
265
|
+
str(include_files_txt),
|
266
|
+
"--checkers",
|
267
|
+
"1000",
|
268
|
+
"--transfers",
|
269
|
+
"1000",
|
270
|
+
]
|
271
|
+
out = self._run(cmd_list)
|
272
|
+
if out.returncode != 0:
|
273
|
+
print(out)
|
274
|
+
raise ValueError(f"Error deleting files: {out.stderr}")
|
275
|
+
|
276
|
+
assert out is not None
|
277
|
+
return out
|
233
278
|
|
234
279
|
def exists(self, path: Dir | Remote | str | File) -> bool:
|
235
280
|
"""Check if a file or directory exists."""
|
@@ -2,6 +2,7 @@ import os
|
|
2
2
|
import shutil
|
3
3
|
import subprocess
|
4
4
|
import time
|
5
|
+
import warnings
|
5
6
|
from pathlib import Path
|
6
7
|
from tempfile import TemporaryDirectory
|
7
8
|
from typing import Any
|
@@ -96,16 +97,17 @@ def rclone_execute(
|
|
96
97
|
cmd_str = subprocess.list2cmdline(cmd)
|
97
98
|
print(f"Running: {cmd_str}")
|
98
99
|
cp = subprocess.run(
|
99
|
-
cmd, capture_output=True, encoding="utf-8", check=
|
100
|
+
cmd, capture_output=True, encoding="utf-8", check=False, shell=False
|
100
101
|
)
|
101
102
|
if cp.returncode != 0:
|
102
103
|
cmd_str = subprocess.list2cmdline(cmd)
|
103
|
-
|
104
|
+
warnings.warn(
|
104
105
|
f"Error running: {cmd_str}, returncode: {cp.returncode}\n{cp.stdout}\n{cp.stderr}"
|
105
106
|
)
|
106
|
-
|
107
|
-
|
108
|
-
|
107
|
+
if check:
|
108
|
+
raise subprocess.CalledProcessError(
|
109
|
+
cp.returncode, cmd, cp.stdout, cp.stderr
|
110
|
+
)
|
109
111
|
return cp
|
110
112
|
finally:
|
111
113
|
if tempdir:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|