Skip to content

Commit c268f76

Browse files
committed
Merge branch 'mount_external_drives' of https://github.com/sumana-2705/datashuttle into mount_external_drives
2 parents 357ac51 + ef40da9 commit c268f76

39 files changed

Lines changed: 772 additions & 512 deletions

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ repos:
1818
- id: requirements-txt-fixer
1919
- id: trailing-whitespace
2020
- repo: https://github.com/astral-sh/ruff-pre-commit
21-
rev: v0.11.8
21+
rev: v0.11.12
2222
hooks:
2323
- id: ruff
2424
- repo: https://github.com/psf/black
2525
rev: 25.1.0
2626
hooks:
2727
- id: black
2828
- repo: https://github.com/pre-commit/mirrors-mypy
29-
rev: v1.15.0
29+
rev: v1.16.0
3030
hooks:
3131
- id: mypy
3232
additional_dependencies:

datashuttle/tui/screens/modal_dialogs.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from datashuttle.tui.app import TuiApp
1313
from datashuttle.utils.custom_types import InterfaceOutput
1414

15-
import os
1615
import platform
1716
from pathlib import Path
1817

@@ -171,7 +170,6 @@ def __init__(
171170
super(SelectDirectoryTreeScreen, self).__init__()
172171
self.mainwindow = mainwindow
173172

174-
175173
if path_ is None:
176174
path_ = Path().home()
177175
self.path_ = path_

datashuttle/tui/shared/validate_content.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def on_button_pressed(self, event: Button.Pressed) -> None:
142142
if self.interface:
143143

144144
if self.interface.project.is_local_project():
145-
include_central = True
145+
include_central = False
146146
else:
147147
include_central = self.query_one(
148148
"#validate_include_central_checkbox"
@@ -155,7 +155,7 @@ def on_button_pressed(self, event: Button.Pressed) -> None:
155155
)
156156
if not success:
157157
self.parent_class.mainwindow.show_modal_error_dialog(
158-
cast(str, output) # noqa
158+
cast("str", output)
159159
)
160160
else:
161161
self.write_results_to_richlog(output)

datashuttle/utils/rclone.py

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import os
2+
import platform
13
import subprocess
4+
import tempfile
25
from pathlib import Path
36
from subprocess import CompletedProcess
47
from typing import Dict, List, Literal
@@ -30,6 +33,45 @@ def call_rclone(command: str, pipe_std: bool = False) -> CompletedProcess:
3033
return output
3134

3235

36+
def call_rclone_through_script(command: str) -> CompletedProcess:
37+
"""
38+
Call rclone through a script, to avoid limits on command-line calls
39+
(in particular on Windows). Used for transfers due to generation of
40+
large call strings.
41+
"""
42+
system = platform.system()
43+
44+
command = "rclone " + command
45+
46+
if system == "Windows":
47+
suffix = ".bat"
48+
else:
49+
suffix = ".sh"
50+
command = "#!/bin/bash\n" + command
51+
52+
with tempfile.NamedTemporaryFile(
53+
mode="w", suffix=suffix, delete=False
54+
) as tmp_script:
55+
tmp_script.write(command)
56+
tmp_script_path = tmp_script.name
57+
58+
try:
59+
if system != "Windows":
60+
os.chmod(tmp_script_path, 0o700)
61+
62+
output = subprocess.run(
63+
[tmp_script_path],
64+
stdout=subprocess.PIPE,
65+
stderr=subprocess.PIPE,
66+
shell=False,
67+
)
68+
69+
finally:
70+
os.remove(tmp_script_path)
71+
72+
return output
73+
74+
3375
# -----------------------------------------------------------------------------
3476
# Setup
3577
# -----------------------------------------------------------------------------
@@ -189,19 +231,17 @@ def transfer_data(
189231
extra_arguments = handle_rclone_arguments(rclone_options, include_list)
190232

191233
if upload_or_download == "upload":
192-
output = call_rclone(
234+
output = call_rclone_through_script(
193235
f"{rclone_args('copy')} "
194236
f'"{local_filepath}" "{cfg.get_rclone_config_name()}:'
195237
f'{central_filepath}" {extra_arguments}',
196-
pipe_std=True,
197238
)
198239

199240
elif upload_or_download == "download":
200-
output = call_rclone(
241+
output = call_rclone_through_script(
201242
f"{rclone_args('copy')} "
202243
f'"{cfg.get_rclone_config_name()}:'
203244
f'{central_filepath}" "{local_filepath}" {extra_arguments}',
204-
pipe_std=True,
205245
)
206246

207247
return output

docs/source/_static/css/custom.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,3 @@ html[data-theme=light] {
4646
height: auto;
4747
margin: 5px auto;
4848
}
49-
50-
.center {
51-
text-align: center;
52-
}

docs/source/_static/screenshots/how-to-choose-a-terminal-bad-dark.png renamed to docs/source/_static/screenshots/choose-a-terminal-bad-dark.png

File renamed without changes.

docs/source/_static/screenshots/how-to-choose-a-terminal-bad-light.png renamed to docs/source/_static/screenshots/choose-a-terminal-bad-light.png

File renamed without changes.

docs/source/_static/screenshots/how-to-choose-a-terminal-good-dark.png renamed to docs/source/_static/screenshots/choose-a-terminal-good-dark.png

File renamed without changes.

docs/source/_static/screenshots/how-to-choose-a-terminal-good-light.png renamed to docs/source/_static/screenshots/choose-a-terminal-good-light.png

File renamed without changes.
-1.05 MB
Loading

0 commit comments

Comments
 (0)