Skip to content

Commit fda2564

Browse files
authored
fix(ghcache.py): emit files to upload in data/tmp (#127)
This provides for a slightly better DX.
1 parent cecf9b5 commit fda2564

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

data/ghcache.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
from pathlib import Path
4343

4444
MANIFEST_PATH = Path("state") / "ghremote" / "manifest.json"
45-
CACHE_DIR = Path("cache/v1")
45+
CACHE_DIR = Path("cache") / "v1"
46+
TMP_DIR = Path("tmp")
4647
SHA256_PREFIX_LENGTH = 12
4748

4849

@@ -153,7 +154,7 @@ def cmd_scan(args) -> int:
153154
3. For new or changed files:
154155
- Compute SHA256
155156
- Create mangled filename
156-
- Copy to current directory (ready for manual upload)
157+
- Copy to tmp directory (ready for manual upload)
157158
- Update manifest
158159
4. Save manifest
159160
"""
@@ -181,6 +182,7 @@ def cmd_scan(args) -> int:
181182
print(f"Found {len(ignored_files)} git-ignored files.")
182183

183184
files_to_upload = []
185+
TMP_DIR.mkdir(parents=True, exist_ok=True)
184186

185187
for file_path in ignored_files:
186188
# Convert to relative path string with forward slashes for cross-platform compatibility
@@ -208,17 +210,17 @@ def cmd_scan(args) -> int:
208210
mangled_name = mangle_path(rel_path, sha256)
209211
print(f" Mangled: {mangled_name}")
210212

211-
# Copy to current directory with mangled name (for manual upload)
212-
dest_path = Path(mangled_name)
213+
# Copy to tmp directory with mangled name (for manual upload)
214+
dest_path = TMP_DIR / mangled_name
213215
shutil.copy2(file_path, dest_path)
214-
print(f" Copied to ./{mangled_name} (ready for upload)")
216+
print(f" Copied to {dest_path} (ready for upload)")
215217

216218
# Prepare manifest entry (URL will need to be filled in manually or via script)
217219
# For now, use placeholder URL
218220
url_placeholder = f"https://github.com/m-lab/iqb/releases/download/v0.2.0/{mangled_name}"
219221

220222
files_dict[rel_path] = {"sha256": sha256, "url": url_placeholder}
221-
files_to_upload.append(mangled_name)
223+
files_to_upload.append(str(dest_path))
222224

223225
# Save updated manifest
224226
save_manifest(manifest)

data/tmp/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

0 commit comments

Comments
 (0)