Skip to content

Commit ca3e688

Browse files
authored
Merge pull request #46 from Decompollaborate/develop
2.9.2
2 parents 96e0ea7 + cb598ab commit ca3e688

File tree

7 files changed

+48
-14
lines changed

7 files changed

+48
-14
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [2.9.2] - 2025-05-28
11+
12+
### Changed
13+
14+
- `objdiff_report`:
15+
- Simplify emitted entries by avoiding using quotes as much as possible when
16+
using the `--emit-categories` flag.
17+
- Avoid printing the summary table when using the `--emit-categories`.
18+
- Allow customizing the output of the summary table a little bit via the
19+
Python API.
20+
1021
## [2.9.1] - 2025-05-27
1122

1223
### Added
@@ -595,6 +606,7 @@ Full changes: <https://github.com/Decompollaborate/mapfile_parser/compare/702a73
595606
- Initial release
596607

597608
[unreleased]: https://github.com/Decompollaborate/mapfile_parser/compare/master...develop
609+
[2.9.2]: https://github.com/Decompollaborate/mapfile_parser/compare/2.9.0...2.9.2
598610
[2.9.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.9.0...2.9.1
599611
[2.9.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.8.1...2.9.0
600612
[2.8.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.8.0...2.8.1

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[package]
55
name = "mapfile_parser"
6-
version = "2.9.1"
6+
version = "2.9.2"
77
edition = "2021"
88
rust-version = "1.74.0"
99
authors = ["Anghelo Carvajal <angheloalf95@gmail.com>"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ If you use a `requirements.txt` file in your repository, then you can add
3636
this library with the following line:
3737

3838
```txt
39-
mapfile_parser>=2.9.1,<3.0.0
39+
mapfile_parser>=2.9.2,<3.0.0
4040
```
4141

4242
#### Development version
@@ -75,7 +75,7 @@ cargo add mapfile_parser
7575
Or add the following line manually to your `Cargo.toml` file:
7676

7777
```toml
78-
mapfile_parser = "2.9.1"
78+
mapfile_parser = "2.9.2"
7979
```
8080

8181
## Versioning and changelog

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[project]
55
name = "mapfile_parser"
6-
version = "2.9.1"
6+
version = "2.9.2"
77
description = "Map file parser library focusing decompilation projects"
88
readme = "README.md"
99
requires-python = ">=3.9"

src/mapfile_parser/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import annotations
77

8-
__version_info__ = (2, 9, 1)
8+
__version_info__ = (2, 9, 2)
99
__version__ = ".".join(map(str, __version_info__)) # + "-dev0"
1010
__author__ = "Decompollaborate"
1111

src/mapfile_parser/frontends/objdiff_report.py

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
from ..internals import objdiff_report as report_internal
1717

1818

19+
@dataclasses.dataclass
20+
class SummaryTableConfig:
21+
doUnits: bool = False
22+
sort: bool = True
23+
remaining: bool = False
24+
1925
def doObjdiffReport(
2026
mapPath: Path,
2127
outputPath: Path,
@@ -27,6 +33,7 @@ def doObjdiffReport(
2733
nonmatchingsPath: Path|None=None,
2834
emitCategories: bool=False,
2935
quiet: bool=False,
36+
summaryTableConfig: SummaryTableConfig|None=SummaryTableConfig(),
3037
) -> int:
3138
if not mapPath.exists():
3239
print(f"Could not find mapfile at '{mapPath}'")
@@ -47,12 +54,16 @@ def doObjdiffReport(
4754
nonmatchingsPath=nonmatchingsPath,
4855
)
4956

50-
if not quiet:
57+
if not quiet and summaryTableConfig is not None and not emitCategories:
5158
report = report_internal.Report.readFile(outputPath)
5259
if report is None:
5360
utils.eprint(f"Unable to read back the generated report at {outputPath}")
5461
return 1
55-
table = report.asTableStr(sort=True)
62+
table = report.asTableStr(
63+
do_units=summaryTableConfig.doUnits,
64+
sort=summaryTableConfig.sort,
65+
remaining=summaryTableConfig.remaining,
66+
)
5667
print(table, end="")
5768

5869
# Output to GitHub Actions job summary, if available
@@ -241,18 +252,26 @@ def decide(old: str, prefixes: list[Path]) -> str:
241252
prefixes_to_trim:
242253
""", end="")
243254
for trim in prefixesToTrim:
244-
print(f" - \"{trim}\"")
255+
print(f" - {trim}")
245256

246257
def printCategories(categories: list[Category]):
247258
for cat in categories:
259+
ide = cat.ide
260+
name = cat.name
261+
if ide[0] in "0123456789":
262+
ide = f'"{ide}"'
263+
if name[0] in "0123456789":
264+
name = f'"{name}"'
248265
print(f"""\
249-
- id: "{cat.ide}"
250-
name: "{cat.name}"
266+
- id: {ide}
267+
name: {name}
251268
paths:
252269
""", end="")
253270
for p in cat.paths:
271+
if p[0] in "0123456789":
272+
p = f'"{p}"'
254273
print(f"""\
255-
- "{p}"
274+
- {p}
256275
""", end="")
257276

258277
print(" categories:")
@@ -323,7 +342,10 @@ def processArguments(args: argparse.Namespace, decompConfig: decomp_settings.Con
323342
nonmatchingsPath = args.nonmatchingspath
324343

325344
emitCategories: bool = args.emit_categories
326-
quiet: bool= args.quiet
345+
if not args.quiet:
346+
summaryTableConfig = SummaryTableConfig()
347+
else:
348+
summaryTableConfig = None
327349

328350
exit(doObjdiffReport(
329351
mapPath,
@@ -334,7 +356,7 @@ def processArguments(args: argparse.Namespace, decompConfig: decomp_settings.Con
334356
pathIndex=pathIndex,
335357
nonmatchingsPath=nonmatchingsPath,
336358
emitCategories=emitCategories,
337-
quiet=quiet
359+
summaryTableConfig=summaryTableConfig,
338360
))
339361

340362
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser], decompConfig: decomp_settings.Config|None=None):

0 commit comments

Comments
 (0)