mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-27 11:58:53 -06:00
refactor: print sizes with one function
core.sizes.size_text replaces readme format_size, release record size_text, render fmt_size, the large-files notes _mib and the handheld _size. It prints one decimal in the largest unit reached, as the site and the installer already did. The README download table, the release notes and the large-files page now say 29.2 MB where they said 29 MB, a handheld archive says 85.3 KB where it said 85 KB, and a large-files asset under 1 MB is given in KB.
This commit is contained in:
1 parent
3a76cf48ba
commit
ab0805e6cb
19 files changed
+60
-71
No files matched your search
@@ -12,6 +12,7 @@ from typing import NamedTuple
|
||||
|
||||
from core.paths import EMULATORS_DIR
|
||||
from core.hashing import file_digest
|
||||
from core.sizes import size_text
|
||||
from model.composition import composition_tier
|
||||
from model.largefiles import LARGE_FILES_RELEASE, LARGE_FILES_REPO, asset_names, registered_paths
|
||||
|
||||
@@ -157,10 +158,6 @@ def _section_for(path: str) -> str:
|
||||
return "Other"
|
||||
|
||||
|
||||
def _mib(size: int) -> str:
|
||||
return f"{round(size / 1048576)} MB"
|
||||
|
||||
|
||||
def render_notes(
|
||||
db: dict,
|
||||
gitignore_text: str,
|
||||
@@ -205,9 +202,9 @@ def render_notes(
|
||||
description = description or name
|
||||
link = f"[{name}]({ASSET_URL}{name})"
|
||||
if section == NOT_INDEXED:
|
||||
line = f"| {link} | {description} | {_mib(size)} |"
|
||||
line = f"| {link} | {description} | {size_text(size)} |"
|
||||
else:
|
||||
line = f"| {link} | {description} | {_mib(size)} | `{sha1}` |"
|
||||
line = f"| {link} | {description} | {size_text(size)} | `{sha1}` |"
|
||||
rows[section].append((-size, line))
|
||||
|
||||
out = [
|
||||
|
||||
Reference in new issue
Block a user