protonfs 0.1.dev43__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.
- protonfs/__init__.py +6 -0
- protonfs/batching.py +17 -0
- protonfs/cli.py +226 -0
- protonfs/commands/__init__.py +0 -0
- protonfs/commands/auth.py +36 -0
- protonfs/commands/ls.py +61 -0
- protonfs/commands/pull.py +85 -0
- protonfs/commands/push.py +94 -0
- protonfs/commands/refresh.py +86 -0
- protonfs/commands/restore.py +9 -0
- protonfs/commands/rm.py +52 -0
- protonfs/commands/setup.py +179 -0
- protonfs/commands/status.py +17 -0
- protonfs/config.py +67 -0
- protonfs/context.py +28 -0
- protonfs/diff.py +83 -0
- protonfs/drive.py +221 -0
- protonfs/ignore.py +43 -0
- protonfs/index.py +55 -0
- protonfs/install.py +288 -0
- protonfs/lfs.py +37 -0
- protonfs/localscan.py +54 -0
- protonfs-0.1.dev43.dist-info/METADATA +198 -0
- protonfs-0.1.dev43.dist-info/RECORD +27 -0
- protonfs-0.1.dev43.dist-info/WHEEL +4 -0
- protonfs-0.1.dev43.dist-info/entry_points.txt +2 -0
- protonfs-0.1.dev43.dist-info/licenses/LICENSE +133 -0
protonfs/install.py
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# src/protonfs/install.py
|
|
2
|
+
"""Self-diagnosing installer for the `proton-drive` prebuilt binary (Tier 3).
|
|
3
|
+
|
|
4
|
+
`pip install protonfs` gives you the Python package; `protonfs install-drive`
|
|
5
|
+
fetches and verifies the official `proton-drive` CLI binary, and `protonfs auth
|
|
6
|
+
login` (a thin passthrough) authenticates it. The installer detects the
|
|
7
|
+
platform, hard-gates on AVX2 for the linux-x64 Bun-compiled prebuilt, downloads
|
|
8
|
+
over HTTPS and verifies the pinned SHA-512 before ever marking the binary
|
|
9
|
+
executable — it never installs an unverified binary.
|
|
10
|
+
|
|
11
|
+
Design notes / accepted deviations from the roadmap decision text:
|
|
12
|
+
- The decision described a bash installer checking curl/unzip. This Python
|
|
13
|
+
implementation downloads via urllib and verifies via hashlib, so those external
|
|
14
|
+
tools are not prerequisites; the decision's intent (self-diagnosing,
|
|
15
|
+
resolve-what-it-can, precise instructive errors) is preserved and the installer
|
|
16
|
+
is unit-testable.
|
|
17
|
+
- The no-AVX2 path emits precise build-from-source instructions rather than
|
|
18
|
+
automating a Bun-baseline source build. That path is defensive only (no current
|
|
19
|
+
target machine lacks AVX2), so automating it is deferred as YAGNI.
|
|
20
|
+
"""
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
import hashlib
|
|
24
|
+
import os
|
|
25
|
+
import platform as _platform
|
|
26
|
+
import shutil
|
|
27
|
+
import stat
|
|
28
|
+
import urllib.request
|
|
29
|
+
from dataclasses import dataclass, field
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
|
|
32
|
+
DEFAULT_VERSION = "0.4.6"
|
|
33
|
+
VERSION_ENV = "PROTONFS_DRIVE_VERSION"
|
|
34
|
+
SHA512_ENV = "PROTONFS_DRIVE_SHA512"
|
|
35
|
+
DOWNLOAD_BASE = "https://proton.me/download/drive/cli"
|
|
36
|
+
DOWNLOAD_TIMEOUT = 60 # seconds; avoids a stalled connection hanging the installer
|
|
37
|
+
|
|
38
|
+
# Pinned SHA-512 of the official prebuilt, keyed by (version, slug). linux-x64 is
|
|
39
|
+
# verified against the released 0.4.6 binary. darwin checksums are added when a
|
|
40
|
+
# maintainer pins them from the official downloads; until then those platforms
|
|
41
|
+
# require an explicit PROTONFS_DRIVE_SHA512 override (we never install unverified).
|
|
42
|
+
PINNED_SHA512 = {
|
|
43
|
+
("0.4.6", "linux-x64"): (
|
|
44
|
+
"d187409932742e6fdc6aae2995998f4c89ea51999283395bc8d0bdc5343a79d3"
|
|
45
|
+
"1bf5a485d5af9adf3b7909fc92f2d2ef0b133edc4939d5faf1d096eb744425bb"
|
|
46
|
+
),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# glibc below this is too old for the Bun-compiled linux-x64 prebuilt. Bun supports
|
|
50
|
+
# glibc >= 2.17 (per the roadmap's target-machine survey: exo2 on CentOS 7 / glibc
|
|
51
|
+
# 2.17 is a confirmed headless-installable target), so we only warn below that.
|
|
52
|
+
MIN_GLIBC = (2, 17)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class InstallError(RuntimeError):
|
|
56
|
+
"""Raised with a precise, instructive message when install cannot proceed."""
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@dataclass
|
|
60
|
+
class Platform:
|
|
61
|
+
slug: str # e.g. "linux-x64"
|
|
62
|
+
os_name: str # "linux" | "darwin"
|
|
63
|
+
arch: str # "x64" | "arm64"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@dataclass
|
|
67
|
+
class InstallResult:
|
|
68
|
+
path: Path
|
|
69
|
+
on_path: bool
|
|
70
|
+
sha512: str
|
|
71
|
+
warnings: list[str] = field(default_factory=list)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def detect_platform(system: str | None = None, machine: str | None = None) -> Platform:
|
|
75
|
+
system = (system or _platform.system()).lower()
|
|
76
|
+
machine = (machine or _platform.machine()).lower()
|
|
77
|
+
if machine in ("x86_64", "amd64"):
|
|
78
|
+
arch = "x64"
|
|
79
|
+
elif machine in ("arm64", "aarch64"):
|
|
80
|
+
arch = "arm64"
|
|
81
|
+
else:
|
|
82
|
+
raise InstallError(
|
|
83
|
+
f"unsupported CPU architecture '{machine}'. The proton-drive prebuilt is "
|
|
84
|
+
f"published for x86_64 and arm64 only."
|
|
85
|
+
)
|
|
86
|
+
if system == "linux":
|
|
87
|
+
if arch != "x64":
|
|
88
|
+
raise InstallError(
|
|
89
|
+
f"no official proton-drive prebuilt for linux-{arch}; only linux-x64 is "
|
|
90
|
+
f"published. Build from source or run on an x86_64 host."
|
|
91
|
+
)
|
|
92
|
+
slug = "linux-x64"
|
|
93
|
+
os_name = "linux"
|
|
94
|
+
elif system == "darwin":
|
|
95
|
+
slug = f"darwin-{arch}"
|
|
96
|
+
os_name = "darwin"
|
|
97
|
+
else:
|
|
98
|
+
raise InstallError(
|
|
99
|
+
f"unsupported OS '{system}'. proton-drive prebuilts exist for linux and macOS."
|
|
100
|
+
)
|
|
101
|
+
return Platform(slug=slug, os_name=os_name, arch=arch)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def resolve_version(version: str | None = None) -> str:
|
|
105
|
+
return version or os.environ.get(VERSION_ENV) or DEFAULT_VERSION
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def binary_url(version: str, slug: str) -> str:
|
|
109
|
+
return f"{DOWNLOAD_BASE}/{version}/{slug}/proton-drive"
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def pinned_sha512(version: str, slug: str) -> str | None:
|
|
113
|
+
"""The expected SHA-512, from the env override first, then the pinned table."""
|
|
114
|
+
override = os.environ.get(SHA512_ENV)
|
|
115
|
+
if override:
|
|
116
|
+
return override.strip().lower()
|
|
117
|
+
return PINNED_SHA512.get((version, slug))
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def has_avx2(cpuinfo_text: str | None = None) -> bool:
|
|
121
|
+
"""Whether the CPU advertises AVX2 (read from /proc/cpuinfo on linux)."""
|
|
122
|
+
if cpuinfo_text is None:
|
|
123
|
+
try:
|
|
124
|
+
cpuinfo_text = Path("/proc/cpuinfo").read_text()
|
|
125
|
+
except OSError:
|
|
126
|
+
return False
|
|
127
|
+
for line in cpuinfo_text.splitlines():
|
|
128
|
+
if line.startswith("flags") and "avx2" in line.split():
|
|
129
|
+
return True
|
|
130
|
+
return False
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def _glibc_version(raw: str | None = None) -> tuple[int, int] | None:
|
|
134
|
+
"""Parse the running glibc version, e.g. 'glibc 2.35' -> (2, 35). None if unknown."""
|
|
135
|
+
if raw is None:
|
|
136
|
+
libc, _ = _platform.libc_ver()
|
|
137
|
+
raw = _platform.libc_ver()[1] if libc == "glibc" else ""
|
|
138
|
+
if not raw:
|
|
139
|
+
return None
|
|
140
|
+
try:
|
|
141
|
+
major, minor = (int(x) for x in raw.split(".")[:2])
|
|
142
|
+
except (ValueError, IndexError):
|
|
143
|
+
return None
|
|
144
|
+
return (major, minor)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def diagnose(plat: Platform, cpuinfo_text: str | None = None,
|
|
148
|
+
glibc_raw: str | None = None) -> list[str]:
|
|
149
|
+
"""Return a list of warning strings for soft issues (empty == all clear).
|
|
150
|
+
|
|
151
|
+
Hard blockers (missing AVX2, unverifiable checksum) are raised by
|
|
152
|
+
install_drive; diagnose covers advisory concerns like an old glibc.
|
|
153
|
+
"""
|
|
154
|
+
warnings: list[str] = []
|
|
155
|
+
if plat.os_name == "linux":
|
|
156
|
+
glibc = _glibc_version(glibc_raw)
|
|
157
|
+
if glibc is not None and glibc < MIN_GLIBC:
|
|
158
|
+
warnings.append(
|
|
159
|
+
f"glibc {glibc[0]}.{glibc[1]} detected; the linux-x64 prebuilt targets "
|
|
160
|
+
f">= {MIN_GLIBC[0]}.{MIN_GLIBC[1]} and may fail to start on this host."
|
|
161
|
+
)
|
|
162
|
+
return warnings
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def _no_avx2_message() -> str:
|
|
166
|
+
have_bun = shutil.which("bun") is not None
|
|
167
|
+
have_git = shutil.which("git") is not None
|
|
168
|
+
steps = (
|
|
169
|
+
"This CPU lacks AVX2, which the official linux-x64 prebuilt requires. "
|
|
170
|
+
"Build a Bun-baseline binary from source instead:"
|
|
171
|
+
)
|
|
172
|
+
prereqs = []
|
|
173
|
+
if not have_bun:
|
|
174
|
+
prereqs.append("install Bun (https://bun.sh)")
|
|
175
|
+
if not have_git:
|
|
176
|
+
prereqs.append("install git")
|
|
177
|
+
if prereqs:
|
|
178
|
+
return (
|
|
179
|
+
f"{steps} first {', and '.join(prereqs)}, then clone "
|
|
180
|
+
f"github.com/ProtonDriveApps/sdk and build the CLI with a baseline target, "
|
|
181
|
+
f"and point PROTONFS_DRIVE_BIN at the result."
|
|
182
|
+
)
|
|
183
|
+
return (
|
|
184
|
+
f"{steps} clone github.com/ProtonDriveApps/sdk, build the CLI with "
|
|
185
|
+
f"`bun build --compile --target=bun-linux-x64-baseline`, and point "
|
|
186
|
+
f"PROTONFS_DRIVE_BIN at the result."
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def resolve_install_dir(path_env: str | None = None) -> tuple[Path, bool]:
|
|
191
|
+
"""Return (install_dir, on_path). Prefer ~/.local/bin when it is on PATH; else a
|
|
192
|
+
managed dir the user surfaces via PROTONFS_DRIVE_BIN."""
|
|
193
|
+
local_bin = Path.home() / ".local" / "bin"
|
|
194
|
+
path_value = os.environ.get("PATH", "") if path_env is None else path_env
|
|
195
|
+
on_path = str(local_bin) in path_value.split(os.pathsep)
|
|
196
|
+
if on_path:
|
|
197
|
+
return local_bin, True
|
|
198
|
+
managed = Path.home() / ".local" / "share" / "protonfs" / "bin"
|
|
199
|
+
return managed, False
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def _default_opener(url: str):
|
|
203
|
+
return urllib.request.urlopen(url, timeout=DOWNLOAD_TIMEOUT)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def download_and_verify(url: str, expected_sha512: str, dest: Path, opener=None) -> str:
|
|
207
|
+
"""Download `url`, verify its SHA-512 equals `expected_sha512`, and write it to
|
|
208
|
+
`dest` (only after verification). Returns the verified digest. Raises InstallError
|
|
209
|
+
on any network/HTTP error or checksum mismatch, always leaving no partial file
|
|
210
|
+
behind."""
|
|
211
|
+
opener = opener or _default_opener
|
|
212
|
+
hasher = hashlib.sha512()
|
|
213
|
+
tmp = dest.with_suffix(dest.suffix + ".part")
|
|
214
|
+
tmp.parent.mkdir(parents=True, exist_ok=True)
|
|
215
|
+
try:
|
|
216
|
+
with opener(url) as resp, open(tmp, "wb") as out:
|
|
217
|
+
while True:
|
|
218
|
+
chunk = resp.read(1024 * 256)
|
|
219
|
+
if not chunk:
|
|
220
|
+
break
|
|
221
|
+
hasher.update(chunk)
|
|
222
|
+
out.write(chunk)
|
|
223
|
+
except OSError as exc:
|
|
224
|
+
# urllib.error.URLError/HTTPError subclass OSError, as do socket timeouts.
|
|
225
|
+
tmp.unlink(missing_ok=True)
|
|
226
|
+
raise InstallError(
|
|
227
|
+
f"failed to download {url}: {exc}. Check your connection, or verify "
|
|
228
|
+
f"{VERSION_ENV} points at a real release."
|
|
229
|
+
) from exc
|
|
230
|
+
digest = hasher.hexdigest()
|
|
231
|
+
if digest.lower() != expected_sha512.lower():
|
|
232
|
+
tmp.unlink(missing_ok=True)
|
|
233
|
+
raise InstallError(
|
|
234
|
+
f"SHA-512 mismatch for {url}: expected {expected_sha512}, got {digest}. "
|
|
235
|
+
f"Refusing to install an unverified binary."
|
|
236
|
+
)
|
|
237
|
+
tmp.replace(dest)
|
|
238
|
+
return digest
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def install_drive(
|
|
242
|
+
version: str | None = None,
|
|
243
|
+
plat: Platform | None = None,
|
|
244
|
+
dest_dir: Path | None = None,
|
|
245
|
+
cpuinfo_text: str | None = None,
|
|
246
|
+
downloader=None,
|
|
247
|
+
) -> InstallResult:
|
|
248
|
+
"""Detect, diagnose, download+verify and install the proton-drive binary."""
|
|
249
|
+
version = resolve_version(version)
|
|
250
|
+
plat = plat or detect_platform()
|
|
251
|
+
|
|
252
|
+
if plat.os_name == "linux" and not has_avx2(cpuinfo_text):
|
|
253
|
+
raise InstallError(_no_avx2_message())
|
|
254
|
+
|
|
255
|
+
expected = pinned_sha512(version, plat.slug)
|
|
256
|
+
if expected is None:
|
|
257
|
+
raise InstallError(
|
|
258
|
+
f"no pinned SHA-512 for proton-drive {version} on {plat.slug}. Set "
|
|
259
|
+
f"{SHA512_ENV} to the official checksum to install, or install manually. "
|
|
260
|
+
f"Refusing to install an unverified binary."
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
if dest_dir is None:
|
|
264
|
+
dest_dir, on_path = resolve_install_dir()
|
|
265
|
+
else:
|
|
266
|
+
on_path = str(dest_dir) in os.environ.get("PATH", "").split(os.pathsep)
|
|
267
|
+
|
|
268
|
+
warnings = diagnose(plat, cpuinfo_text)
|
|
269
|
+
override = os.environ.get(SHA512_ENV)
|
|
270
|
+
base_pin = PINNED_SHA512.get((version, plat.slug))
|
|
271
|
+
if override and base_pin and override.strip().lower() != base_pin.lower():
|
|
272
|
+
warnings.append(
|
|
273
|
+
f"{SHA512_ENV} overrides the pinned checksum for {plat.slug} {version}; "
|
|
274
|
+
f"installing against the override, not the audited pin."
|
|
275
|
+
)
|
|
276
|
+
url = binary_url(version, plat.slug)
|
|
277
|
+
dest = dest_dir / "proton-drive"
|
|
278
|
+
digest = download_and_verify(url, expected, dest, opener=downloader)
|
|
279
|
+
|
|
280
|
+
mode = dest.stat().st_mode
|
|
281
|
+
dest.chmod(mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
|
282
|
+
|
|
283
|
+
if not on_path:
|
|
284
|
+
warnings.append(
|
|
285
|
+
f"{dest_dir} is not on PATH; export PROTONFS_DRIVE_BIN={dest} (or add the "
|
|
286
|
+
f"directory to PATH) so protonfs can find the binary."
|
|
287
|
+
)
|
|
288
|
+
return InstallResult(path=dest, on_path=on_path, sha512=digest, warnings=warnings)
|
protonfs/lfs.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# src/protonfs/lfs.py
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import subprocess
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
POINTER_SIGNATURE = "version https://git-lfs.github.com/spec/v1"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def is_lfs_tracked(repo_root: Path) -> bool:
|
|
11
|
+
gitattributes = repo_root / ".gitattributes"
|
|
12
|
+
if gitattributes.exists() and "filter=lfs" in gitattributes.read_text():
|
|
13
|
+
return True
|
|
14
|
+
result = subprocess.run(
|
|
15
|
+
["git", "-C", str(repo_root), "lfs", "ls-files"],
|
|
16
|
+
capture_output=True,
|
|
17
|
+
text=True,
|
|
18
|
+
)
|
|
19
|
+
return result.returncode == 0 and bool(result.stdout.strip())
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def is_pointer_stub(path: Path) -> bool:
|
|
23
|
+
try:
|
|
24
|
+
with path.open("r", errors="ignore") as fh:
|
|
25
|
+
first_line = fh.readline()
|
|
26
|
+
except OSError:
|
|
27
|
+
return False
|
|
28
|
+
return first_line.strip() == POINTER_SIGNATURE
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def find_pointer_stubs(root: Path, subpath: Path) -> list[Path]:
|
|
32
|
+
base = root / subpath if subpath != Path(".") else root
|
|
33
|
+
stubs = []
|
|
34
|
+
for file_path in sorted(base.rglob("*")):
|
|
35
|
+
if file_path.is_file() and file_path.stat().st_size < 200 and is_pointer_stub(file_path):
|
|
36
|
+
stubs.append(file_path)
|
|
37
|
+
return stubs
|
protonfs/localscan.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import hashlib
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from protonfs.config import CONFIG_DIR_NAME
|
|
8
|
+
from protonfs.ignore import IgnoreMatcher
|
|
9
|
+
from protonfs.index import IndexStore
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class ScanEntry:
|
|
14
|
+
rel_path: str
|
|
15
|
+
size: int
|
|
16
|
+
mtime: float
|
|
17
|
+
sha256: str
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def hash_file(path: Path) -> str:
|
|
21
|
+
digest = hashlib.sha256()
|
|
22
|
+
with path.open("rb") as fh:
|
|
23
|
+
for chunk in iter(lambda: fh.read(1024 * 1024), b""):
|
|
24
|
+
digest.update(chunk)
|
|
25
|
+
return digest.hexdigest()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def scan(
|
|
29
|
+
root: Path,
|
|
30
|
+
subpath: Path,
|
|
31
|
+
ignore: IgnoreMatcher,
|
|
32
|
+
index: IndexStore,
|
|
33
|
+
low_io: bool = False,
|
|
34
|
+
) -> dict[str, ScanEntry]:
|
|
35
|
+
entries: dict[str, ScanEntry] = {}
|
|
36
|
+
base = root / subpath if subpath != Path(".") else root
|
|
37
|
+
for file_path in sorted(base.rglob("*")):
|
|
38
|
+
if not file_path.is_file():
|
|
39
|
+
continue
|
|
40
|
+
rel_path = str(file_path.relative_to(root))
|
|
41
|
+
if rel_path == CONFIG_DIR_NAME or rel_path.startswith(f"{CONFIG_DIR_NAME}/"):
|
|
42
|
+
continue
|
|
43
|
+
if ignore.matches(rel_path):
|
|
44
|
+
continue
|
|
45
|
+
stat = file_path.stat()
|
|
46
|
+
size = stat.st_size
|
|
47
|
+
mtime = stat.st_mtime
|
|
48
|
+
cached = index.get(rel_path)
|
|
49
|
+
if low_io and cached is not None and cached.size == size and cached.mtime == mtime:
|
|
50
|
+
sha256 = cached.sha256
|
|
51
|
+
else:
|
|
52
|
+
sha256 = hash_file(file_path)
|
|
53
|
+
entries[rel_path] = ScanEntry(rel_path=rel_path, size=size, mtime=mtime, sha256=sha256)
|
|
54
|
+
return entries
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: protonfs
|
|
3
|
+
Version: 0.1.dev43
|
|
4
|
+
Summary: Sync a local directory tree with Proton Drive via the official Proton Drive CLI, with conflict-aware push/pull and a local sync manifest.
|
|
5
|
+
Project-URL: Homepage, https://github.com/will-roscoe/protonfs
|
|
6
|
+
Project-URL: Issues, https://github.com/will-roscoe/protonfs/issues
|
|
7
|
+
Author: Will Roscoe
|
|
8
|
+
License: PolyForm Noncommercial License 1.0.0
|
|
9
|
+
|
|
10
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
11
|
+
|
|
12
|
+
Required Notice: Copyright Will Roscoe (https://github.com/will-roscoe)
|
|
13
|
+
|
|
14
|
+
## Acceptance
|
|
15
|
+
|
|
16
|
+
In order to get any license under these terms, you must agree
|
|
17
|
+
to them as both strict obligations and conditions to all
|
|
18
|
+
your licenses.
|
|
19
|
+
|
|
20
|
+
## Copyright License
|
|
21
|
+
|
|
22
|
+
The licensor grants you a copyright license for the
|
|
23
|
+
software to do everything you might do with the software
|
|
24
|
+
that would otherwise infringe the licensor's copyright
|
|
25
|
+
in it for any permitted purpose. However, you may
|
|
26
|
+
only distribute the software according to Distribution
|
|
27
|
+
License and make changes or new works
|
|
28
|
+
based on the software according to Changes and New Works
|
|
29
|
+
License.
|
|
30
|
+
|
|
31
|
+
## Distribution License
|
|
32
|
+
|
|
33
|
+
The licensor grants you an additional copyright license
|
|
34
|
+
to distribute copies of the software. Your license
|
|
35
|
+
to distribute covers distributing the software with
|
|
36
|
+
changes and new works permitted by Changes and New Works
|
|
37
|
+
License.
|
|
38
|
+
|
|
39
|
+
## Notices
|
|
40
|
+
|
|
41
|
+
You must ensure that anyone who gets a copy of any part of
|
|
42
|
+
the software from you also gets a copy of these terms or the
|
|
43
|
+
URL for them above, as well as copies of any plain-text lines
|
|
44
|
+
beginning with "Required Notice:" that the licensor provided
|
|
45
|
+
with the software. For example:
|
|
46
|
+
|
|
47
|
+
Required Notice: Copyright Will Roscoe (https://github.com/will-roscoe)
|
|
48
|
+
|
|
49
|
+
## Changes and New Works License
|
|
50
|
+
|
|
51
|
+
The licensor grants you an additional copyright license to
|
|
52
|
+
make changes and new works based on the software for any
|
|
53
|
+
permitted purpose.
|
|
54
|
+
|
|
55
|
+
## Patent License
|
|
56
|
+
|
|
57
|
+
The licensor grants you a patent license for the software that
|
|
58
|
+
covers patent claims the licensor can license, or becomes able
|
|
59
|
+
to license, that you would infringe by using the software.
|
|
60
|
+
|
|
61
|
+
## Noncommercial Purposes
|
|
62
|
+
|
|
63
|
+
Any noncommercial purpose is a permitted purpose.
|
|
64
|
+
|
|
65
|
+
## Personal Uses
|
|
66
|
+
|
|
67
|
+
Personal use for research, experiment, and testing for
|
|
68
|
+
the benefit of public knowledge, personal study, private
|
|
69
|
+
entertainment, hobby projects, amateur pursuits, or religious
|
|
70
|
+
observance, without any anticipated commercial application,
|
|
71
|
+
is use for a permitted purpose.
|
|
72
|
+
|
|
73
|
+
## Noncommercial Organizations
|
|
74
|
+
|
|
75
|
+
Use by any charitable organization, educational institution,
|
|
76
|
+
public research organization, public safety or health
|
|
77
|
+
organization, environmental protection organization,
|
|
78
|
+
or government institution is use for a permitted purpose
|
|
79
|
+
regardless of the source of funding or obligations resulting
|
|
80
|
+
from the funding.
|
|
81
|
+
|
|
82
|
+
## Fair Use
|
|
83
|
+
|
|
84
|
+
You may have "fair use" rights for the software under the
|
|
85
|
+
law. These terms do not limit them.
|
|
86
|
+
|
|
87
|
+
## No Other Rights
|
|
88
|
+
|
|
89
|
+
These terms do not allow you to sublicense or transfer any of
|
|
90
|
+
your licenses to anyone else, or prevent the licensor from
|
|
91
|
+
granting licenses to anyone else. These terms do not imply
|
|
92
|
+
any other licenses.
|
|
93
|
+
|
|
94
|
+
## Patent Defense
|
|
95
|
+
|
|
96
|
+
If you make any written claim that the software infringes or
|
|
97
|
+
contributes to infringement of any patent, your patent license
|
|
98
|
+
for the software granted under these terms ends immediately. If
|
|
99
|
+
your company makes such a claim, your patent license ends
|
|
100
|
+
immediately for work on behalf of your company.
|
|
101
|
+
|
|
102
|
+
## Violations
|
|
103
|
+
|
|
104
|
+
The first time you are notified in writing that you have
|
|
105
|
+
violated any of these terms, or done anything with the software
|
|
106
|
+
not covered by your licenses, your licenses can nonetheless
|
|
107
|
+
continue if you come into full compliance with these terms,
|
|
108
|
+
and take practical steps to correct past violations, within
|
|
109
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
110
|
+
end immediately.
|
|
111
|
+
|
|
112
|
+
## No Liability
|
|
113
|
+
|
|
114
|
+
As far as the law allows, the software comes as is, without
|
|
115
|
+
any warranty or condition, and the licensor will not be liable
|
|
116
|
+
to you for any damages arising out of these terms or the use
|
|
117
|
+
or nature of the software, under any kind of legal claim.
|
|
118
|
+
|
|
119
|
+
## Definitions
|
|
120
|
+
|
|
121
|
+
The licensor is the individual or entity offering these
|
|
122
|
+
terms, and the software is the software the licensor makes
|
|
123
|
+
available under these terms.
|
|
124
|
+
|
|
125
|
+
You refers to the individual or entity agreeing to these
|
|
126
|
+
terms.
|
|
127
|
+
|
|
128
|
+
Your company is any legal entity, sole proprietorship,
|
|
129
|
+
or other kind of organization that you work for, plus all
|
|
130
|
+
organizations that have control over, are under the control of,
|
|
131
|
+
or are under common control with that organization. Control
|
|
132
|
+
means ownership of substantially all the assets of an entity,
|
|
133
|
+
or the power to direct its management and policies by vote,
|
|
134
|
+
contract, or otherwise. Control can be direct or indirect.
|
|
135
|
+
|
|
136
|
+
Your licenses are all the licenses granted to you for the
|
|
137
|
+
software under these terms.
|
|
138
|
+
|
|
139
|
+
Use means anything you do with the software requiring one
|
|
140
|
+
of your licenses.
|
|
141
|
+
License-File: LICENSE
|
|
142
|
+
Classifier: Environment :: Console
|
|
143
|
+
Classifier: License :: Other/Proprietary License
|
|
144
|
+
Classifier: Operating System :: MacOS
|
|
145
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
146
|
+
Classifier: Programming Language :: Python :: 3
|
|
147
|
+
Requires-Python: >=3.9
|
|
148
|
+
Requires-Dist: click>=8.1
|
|
149
|
+
Requires-Dist: pathspec>=0.12
|
|
150
|
+
Requires-Dist: rich>=13.0
|
|
151
|
+
Provides-Extra: dev
|
|
152
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
153
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
154
|
+
Provides-Extra: docs
|
|
155
|
+
Requires-Dist: furo; extra == 'docs'
|
|
156
|
+
Requires-Dist: sphinx; extra == 'docs'
|
|
157
|
+
Requires-Dist: sphinx-autobuild; extra == 'docs'
|
|
158
|
+
Requires-Dist: sphinx-autodoc-typehints; extra == 'docs'
|
|
159
|
+
Requires-Dist: sphinx-copybutton; extra == 'docs'
|
|
160
|
+
Description-Content-Type: text/markdown
|
|
161
|
+
|
|
162
|
+
# protonfs
|
|
163
|
+
|
|
164
|
+
Sync a local directory tree with [Proton Drive](https://proton.me/drive), via
|
|
165
|
+
the official [Proton Drive CLI](https://github.com/ProtonDriveApps/sdk/tree/main/cli),
|
|
166
|
+
with conflict-aware push/pull and a local sync manifest.
|
|
167
|
+
|
|
168
|
+
Originally built to replace git-lfs as the storage layer for large,
|
|
169
|
+
write-once simulation output — data that doesn't need version history, just
|
|
170
|
+
somewhere durable to live and a way to fetch it back on demand.
|
|
171
|
+
|
|
172
|
+
The command surface (`setup`, `status`, `ls`, `push`, `pull`, `rm`, `restore`,
|
|
173
|
+
`refresh`, `install-drive`, `auth`) is implemented — see `src/protonfs/cli.py`.
|
|
174
|
+
|
|
175
|
+
## Requirements
|
|
176
|
+
|
|
177
|
+
- Python >= 3.9
|
|
178
|
+
- The [`proton-drive`](https://proton.me/download/drive/cli/index.html) CLI
|
|
179
|
+
binary — install it with `protonfs install-drive` (below), or supply your own
|
|
180
|
+
on `PATH` / via `PROTONFS_DRIVE_BIN`.
|
|
181
|
+
|
|
182
|
+
## Install
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
pip install protonfs
|
|
186
|
+
protonfs install-drive # downloads + SHA-512-verifies the official proton-drive binary
|
|
187
|
+
protonfs auth login # opens a URL to authenticate (passthrough to proton-drive)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`install-drive` detects your platform, requires AVX2 for the linux-x64 prebuilt
|
|
191
|
+
(with an instructive fallback otherwise), and never installs a binary whose
|
|
192
|
+
SHA-512 does not match the pinned checksum. Override the version with
|
|
193
|
+
`PROTONFS_DRIVE_VERSION` and the expected checksum with `PROTONFS_DRIVE_SHA512`.
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
[PolyForm Noncommercial 1.0.0](LICENSE) — free for noncommercial use with
|
|
198
|
+
attribution; contact the author for commercial use.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
protonfs/__init__.py,sha256=p9EGklRYIQg4Fm6G8jh5R9ALXXn7nnjZBVcCmd1cmBQ,168
|
|
2
|
+
protonfs/batching.py,sha256=_jqOk6e9Le43kyzJKgTG1iD-cFUy58cnPenCd_gP1b0,470
|
|
3
|
+
protonfs/cli.py,sha256=SQNX5khaOzEkttpSfxHzQQI8jhDZ0umjxJF3ihoWIKk,8170
|
|
4
|
+
protonfs/config.py,sha256=iEcSiFaQSCTVL5aFP5dWdbxJwSUV9wXl2i9jENIgMw8,1768
|
|
5
|
+
protonfs/context.py,sha256=m9rsZ_psfGgPxbQyE_MyHViRxV-t94Z7HD7xG_FVBEg,729
|
|
6
|
+
protonfs/diff.py,sha256=ROV21UClQ6mz71NuZFuDbc-4c98gzA6k1Be0-zd6Aio,2732
|
|
7
|
+
protonfs/drive.py,sha256=-8d8eIrAfVfHnB8ypOGthZ_BzGSQISqVijAuLxyWVtA,7743
|
|
8
|
+
protonfs/ignore.py,sha256=EfjBMFtmAz8UsrC7ZaHOJ0fxrDi_U0CL4Q2pHaNLxPo,1076
|
|
9
|
+
protonfs/index.py,sha256=KNswlDVaNZJhPCCmeox31p58cTf5Ygz_8Vejs3Y0xMI,1579
|
|
10
|
+
protonfs/install.py,sha256=lMWQfdVN6KSeWpoEtDJnevACcRSjdjN7yqMNUlIWwOI,11053
|
|
11
|
+
protonfs/lfs.py,sha256=QBD9gM22v9iCJvYwOpn9rg11306w1GbrXfoNaYLJpJE,1141
|
|
12
|
+
protonfs/localscan.py,sha256=KOFO7vPnKtCgo0KzYspVVoN4tnPenDpMXkUjugQf-bo,1547
|
|
13
|
+
protonfs/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
protonfs/commands/auth.py,sha256=n3YV7ptj_TlLjDer0-U6QiEM36zEUDXtHn3py_VlM1U,1517
|
|
15
|
+
protonfs/commands/ls.py,sha256=q-mbVMBlIPxMEtg2Z0p7sHCGoKH5J4YwKFiHyrBLf4I,2268
|
|
16
|
+
protonfs/commands/pull.py,sha256=HEGBEikTeX0GfEH_Ch9OF25dr6R0rP56aVJj4uZYHxE,3378
|
|
17
|
+
protonfs/commands/push.py,sha256=ZTTvLb18th-T4Tnr-XhhM93SykT0AyTKMVVxyt4EZCs,3661
|
|
18
|
+
protonfs/commands/refresh.py,sha256=3OeQOnle9uiqs4z4SpodZ6tw5WLS249jJPf-2Qhsf_k,3077
|
|
19
|
+
protonfs/commands/restore.py,sha256=yqEAPP--EmJOU54_e8aNgsKBM4MLaDHGg8CqGhqmI8I,295
|
|
20
|
+
protonfs/commands/rm.py,sha256=_pc5tYwEuGyh4miXS6kywjQeMckp6ph4qFoNN56PGJs,2123
|
|
21
|
+
protonfs/commands/setup.py,sha256=eZb7P6ZKLGZ5zhh8WraoiJ0BDn2kXbGKxD3BPme6qLA,6689
|
|
22
|
+
protonfs/commands/status.py,sha256=DSFWWOswnFY6fEyGmHQc9Jq-__0WLLFljAUxkKdzexM,615
|
|
23
|
+
protonfs-0.1.dev43.dist-info/METADATA,sha256=75pGLawuWNLVeRaaAiNuopXES_mN2bNYNkMKqGrkp3s,8180
|
|
24
|
+
protonfs-0.1.dev43.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
25
|
+
protonfs-0.1.dev43.dist-info/entry_points.txt,sha256=d4DtJu8SQN6WiDq9GBx8ezCPG_EvjIqvBxfe37YFCzw,47
|
|
26
|
+
protonfs-0.1.dev43.dist-info/licenses/LICENSE,sha256=XDZ7TIaWLSypaEoIOAM-LDTBCVdJrGErQr4OdWVGf4A,4507
|
|
27
|
+
protonfs-0.1.dev43.dist-info/RECORD,,
|