mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 02:27:52 -06:00
refactor: tidy packpaths and torrentzip returns
This commit is contained in:
1 parent
59941727ee
commit
fe25a7caa0
2 files changed
+8
-11
No files matched your search
@@ -161,9 +161,7 @@ def _has_path_conflict(dest: str, seen_files: set[str], seen_parents: set[str])
|
||||
for parent in _path_parents(dest):
|
||||
if parent in seen_files:
|
||||
return True
|
||||
if dest in seen_parents:
|
||||
return True
|
||||
return False
|
||||
return dest in seen_parents
|
||||
|
||||
def placement_block(
|
||||
dest: str,
|
||||
|
||||
@@ -217,6 +217,8 @@ def main() -> int:
|
||||
parser.add_argument("--rebuild", metavar="ZIP", help="normalize an archive")
|
||||
parser.add_argument("--output", "-o", help="output path for --rebuild")
|
||||
args = parser.parse_args()
|
||||
if not (args.check or args.rebuild):
|
||||
parser.error("nothing to do: pass --check or --rebuild")
|
||||
|
||||
if args.check:
|
||||
data = Path(args.check).read_bytes()
|
||||
@@ -228,14 +230,11 @@ def main() -> int:
|
||||
print(f" conform: {data == rebuilt}")
|
||||
return 0 if data == rebuilt else 1
|
||||
|
||||
if args.rebuild:
|
||||
data = rebuild_torrentzip(args.rebuild)
|
||||
dest = args.output or args.rebuild
|
||||
Path(dest).write_bytes(data)
|
||||
print(f"{dest}: {len(data)} bytes, md5 {hashlib.md5(data).hexdigest()}")
|
||||
return 0
|
||||
|
||||
parser.error("nothing to do: pass --check or --rebuild")
|
||||
data = rebuild_torrentzip(args.rebuild)
|
||||
dest = args.output or args.rebuild
|
||||
Path(dest).write_bytes(data)
|
||||
print(f"{dest}: {len(data)} bytes, md5 {hashlib.md5(data).hexdigest()}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user