|
30 | 30 |
|
31 | 31 | PWD = Path.cwd() |
32 | 32 |
|
| 33 | +PYI_HASHES = "pyi_hashes.json" |
| 34 | + |
33 | 35 | EXCLUDED_FILES = [ |
34 | 36 | "app.py", |
35 | 37 | "component.py", |
@@ -1264,45 +1266,48 @@ def scan_all( |
1264 | 1266 | file_parent = file_path.parent |
1265 | 1267 | while len(file_parent.parts) > len(top_dir.parts): |
1266 | 1268 | file_parent = file_parent.parent |
| 1269 | + while len(top_dir.parts) > len(file_parent.parts): |
| 1270 | + top_dir = top_dir.parent |
1267 | 1271 | while not file_parent.samefile(top_dir): |
1268 | 1272 | file_parent = file_parent.parent |
1269 | 1273 | top_dir = top_dir.parent |
1270 | 1274 |
|
1271 | | - pyi_hashes_file = top_dir / "pyi_hashes.json" |
1272 | | - if not pyi_hashes_file.exists(): |
1273 | | - while top_dir.parent and not (top_dir / "pyi_hashes.json").exists(): |
1274 | | - top_dir = top_dir.parent |
1275 | | - another_pyi_hashes_file = top_dir / "pyi_hashes.json" |
1276 | | - if another_pyi_hashes_file.exists(): |
1277 | | - pyi_hashes_file = another_pyi_hashes_file |
1278 | | - |
1279 | | - pyi_hashes_file.write_text( |
1280 | | - json.dumps( |
1281 | | - dict( |
1282 | | - zip( |
1283 | | - [ |
1284 | | - f.relative_to(pyi_hashes_file.parent).as_posix() |
1285 | | - for f in file_paths |
1286 | | - ], |
1287 | | - hashes, |
1288 | | - strict=True, |
1289 | | - ) |
1290 | | - ), |
1291 | | - indent=2, |
1292 | | - sort_keys=True, |
| 1275 | + while ( |
| 1276 | + not top_dir.samefile(top_dir.parent) |
| 1277 | + and not (top_dir / PYI_HASHES).exists() |
| 1278 | + ): |
| 1279 | + top_dir = top_dir.parent |
| 1280 | + |
| 1281 | + pyi_hashes_file = top_dir / PYI_HASHES |
| 1282 | + |
| 1283 | + if pyi_hashes_file.exists(): |
| 1284 | + pyi_hashes_file.write_text( |
| 1285 | + json.dumps( |
| 1286 | + dict( |
| 1287 | + zip( |
| 1288 | + [ |
| 1289 | + f.relative_to(pyi_hashes_file.parent).as_posix() |
| 1290 | + for f in file_paths |
| 1291 | + ], |
| 1292 | + hashes, |
| 1293 | + strict=True, |
| 1294 | + ) |
| 1295 | + ), |
| 1296 | + indent=2, |
| 1297 | + sort_keys=True, |
| 1298 | + ) |
| 1299 | + + "\n", |
1293 | 1300 | ) |
1294 | | - + "\n", |
1295 | | - ) |
1296 | 1301 | elif file_paths: |
1297 | 1302 | file_paths = list(map(Path, file_paths)) |
1298 | 1303 | pyi_hashes_parent = file_paths[0].parent |
1299 | 1304 | while ( |
1300 | | - pyi_hashes_parent.parent |
1301 | | - and not (pyi_hashes_parent / "pyi_hashes.json").exists() |
| 1305 | + not pyi_hashes_parent.samefile(pyi_hashes_parent.parent) |
| 1306 | + and not (pyi_hashes_parent / PYI_HASHES).exists() |
1302 | 1307 | ): |
1303 | 1308 | pyi_hashes_parent = pyi_hashes_parent.parent |
1304 | 1309 |
|
1305 | | - pyi_hashes_file = pyi_hashes_parent / "pyi_hashes.json" |
| 1310 | + pyi_hashes_file = pyi_hashes_parent / PYI_HASHES |
1306 | 1311 | if pyi_hashes_file.exists(): |
1307 | 1312 | pyi_hashes = json.loads(pyi_hashes_file.read_text()) |
1308 | 1313 | for file_path, hashed_content in zip( |
|
0 commit comments