Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Johnson <[email protected]>
  • Loading branch information
colincornaby and Hoikas committed Jul 18, 2024
1 parent ca85d8d commit 28e387d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions urumanifest/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _hash_asset(args: Tuple[Path, Path, bool]) -> Tuple[Path, str, int]:
bundle_name = source_path.stem
# Guess the executable path - we could get the exact name if we could unpack the Info.plist
# in a cross platform way.
source_path = source_path.joinpath(Path("Contents/MacOS", bundle_name))
source_path = source_path.joinpath("Contents", MacOS", bundle_name)
with source_path.open("rb") as in_stream:
_io_loop(in_stream, h.update)
return server_path, h.hexdigest(), source_path.stat().st_size
Expand Down Expand Up @@ -128,10 +128,8 @@ def on_compress(asset: manifest.ManifestEntry, future: concurrent.futures.Future
for server_path, staged_asset, source_asset, cached_asset in asset_iter:
assert server_path.parent.name

if staged_asset.flags & ManifestFlags.bundle:
asset_output_path = output_path.joinpath(server_path).with_suffix(f"{server_path.suffix}.tgz")
else:
asset_output_path = output_path.joinpath(server_path).with_suffix(f"{server_path.suffix}.gz")
output_suffix = "tgz" if staged_asset.flags & ManifestFlags.bundle else "gz"
asset_output_path = output_path.joinpath(server_path).with_suffix(f"{server_path.suffix}.{output_suffix}")
staged_asset.download_name = asset_output_path.relative_to(output_path)

# While the old, sucky manifest generator was picky about what it compressed, we're not
Expand All @@ -143,7 +141,7 @@ def on_compress(asset: manifest.ManifestEntry, future: concurrent.futures.Future
future = executor.submit(_compress_asset,
source_asset.source_path,
asset_output_path,
staged_asset.flags & ManifestFlags.bundle)
staged_asset.flags & ManifestFlags.bundle)
future.add_done_callback(functools.partial(on_compress, staged_asset))
else:
staged_asset.download_hash = cached_asset.download_hash
Expand Down
2 changes: 1 addition & 1 deletion urumanifest/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def iter_client_dir():
# Bundles might add multiple members with the same name - clean that up
desired_bundles = list(set([i.name for i in list(filter(lambda x: x.bundle == True, desired_members))]))
gather_package = { gather_key: desired_files }
if len(desired_bundles) > 0:
if desired_bundles:
key = "macBundleExternal" if gather_key == "macExternal" else "macBundleInternal"
gather_package[key] = desired_bundles
with output_path.joinpath("control.json").open("w") as fp:
Expand Down

0 comments on commit 28e387d

Please sign in to comment.