|
42 | 42 | from pathlib import Path |
43 | 43 |
|
44 | 44 | MANIFEST_PATH = Path("state") / "ghremote" / "manifest.json" |
45 | | -CACHE_DIR = Path("cache/v1") |
| 45 | +CACHE_DIR = Path("cache") / "v1" |
| 46 | +TMP_DIR = Path("tmp") |
46 | 47 | SHA256_PREFIX_LENGTH = 12 |
47 | 48 |
|
48 | 49 |
|
@@ -153,7 +154,7 @@ def cmd_scan(args) -> int: |
153 | 154 | 3. For new or changed files: |
154 | 155 | - Compute SHA256 |
155 | 156 | - Create mangled filename |
156 | | - - Copy to current directory (ready for manual upload) |
| 157 | + - Copy to tmp directory (ready for manual upload) |
157 | 158 | - Update manifest |
158 | 159 | 4. Save manifest |
159 | 160 | """ |
@@ -181,6 +182,7 @@ def cmd_scan(args) -> int: |
181 | 182 | print(f"Found {len(ignored_files)} git-ignored files.") |
182 | 183 |
|
183 | 184 | files_to_upload = [] |
| 185 | + TMP_DIR.mkdir(parents=True, exist_ok=True) |
184 | 186 |
|
185 | 187 | for file_path in ignored_files: |
186 | 188 | # Convert to relative path string with forward slashes for cross-platform compatibility |
@@ -208,17 +210,17 @@ def cmd_scan(args) -> int: |
208 | 210 | mangled_name = mangle_path(rel_path, sha256) |
209 | 211 | print(f" Mangled: {mangled_name}") |
210 | 212 |
|
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 |
213 | 215 | 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)") |
215 | 217 |
|
216 | 218 | # Prepare manifest entry (URL will need to be filled in manually or via script) |
217 | 219 | # For now, use placeholder URL |
218 | 220 | url_placeholder = f"https://github.com/m-lab/iqb/releases/download/v0.2.0/{mangled_name}" |
219 | 221 |
|
220 | 222 | files_dict[rel_path] = {"sha256": sha256, "url": url_placeholder} |
221 | | - files_to_upload.append(mangled_name) |
| 223 | + files_to_upload.append(str(dest_path)) |
222 | 224 |
|
223 | 225 | # Save updated manifest |
224 | 226 | save_manifest(manifest) |
|
0 commit comments