From a07e65e8541ec5a482e355e0ac3b788107608602 Mon Sep 17 00:00:00 2001 From: angie Date: Fri, 26 Jan 2024 12:19:25 -0300 Subject: [PATCH 1/3] Frontend scripts now give a better error if the mapfile does not exist --- CHANGELOG.md | 4 ++++ src/mapfile_parser/frontends/jsonify.py | 4 ++++ src/mapfile_parser/frontends/pj64_syms.py | 4 ++++ src/mapfile_parser/frontends/progress.py | 4 ++++ src/mapfile_parser/frontends/sym_info.py | 4 ++++ src/mapfile_parser/frontends/symbol_sizes_csv.py | 4 ++++ src/mapfile_parser/frontends/upload_frogress.py | 4 ++++ 7 files changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b633a96..4e6bc12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Frontend scripts now give a better error if the mapfile does not exist. + ## [2.3.2] - 2024-01-17 ### Added diff --git a/src/mapfile_parser/frontends/jsonify.py b/src/mapfile_parser/frontends/jsonify.py index ca7dbd6..7b1a785 100644 --- a/src/mapfile_parser/frontends/jsonify.py +++ b/src/mapfile_parser/frontends/jsonify.py @@ -13,6 +13,10 @@ def doJsonify(mapPath: Path, outputPath: Path|None, humanReadable: bool=True) -> int: + if not mapPath.exists(): + print(f"Could not find mapfile at '{mapPath}'") + return 1 + mapFile = mapfile.MapFile() mapFile.readMapFile(mapPath) diff --git a/src/mapfile_parser/frontends/pj64_syms.py b/src/mapfile_parser/frontends/pj64_syms.py index 93f4168..a2dd6bf 100644 --- a/src/mapfile_parser/frontends/pj64_syms.py +++ b/src/mapfile_parser/frontends/pj64_syms.py @@ -21,6 +21,10 @@ def writePj64SymsToFile(mapFile: mapfile.MapFile, outFile: TextIO): outFile.write(f"{sym.vram:08X},{symType},{sym.name}\n") def doPj64Syms(mapPath: Path, outputPath: Path|None) -> int: + if not mapPath.exists(): + print(f"Could not find mapfile at '{mapPath}'") + return 1 + mapFile = mapfile.MapFile() mapFile.readMapFile(mapPath) diff --git a/src/mapfile_parser/frontends/progress.py b/src/mapfile_parser/frontends/progress.py index 65753b2..ab3326c 100644 --- a/src/mapfile_parser/frontends/progress.py +++ b/src/mapfile_parser/frontends/progress.py @@ -21,6 +21,10 @@ def getProgress(mapPath: Path, asmPath: Path, nonmatchingsPath: Path, pathIndex: return mapFile.filterBySectionType(".text").getProgress(asmPath, nonmatchingsPath, pathIndex=pathIndex) def doProgress(mapPath: Path, asmPath: Path, nonmatchingsPath: Path, pathIndex: int=2, debugging: bool=False) -> int: + if not mapPath.exists(): + print(f"Could not find mapfile at '{mapPath}'") + return 1 + totalStats, progressPerFolder = getProgress(mapPath, asmPath, nonmatchingsPath, pathIndex=pathIndex, debugging=debugging) progress_stats.printStats(totalStats, progressPerFolder) diff --git a/src/mapfile_parser/frontends/sym_info.py b/src/mapfile_parser/frontends/sym_info.py index eaf9259..ec98fdd 100644 --- a/src/mapfile_parser/frontends/sym_info.py +++ b/src/mapfile_parser/frontends/sym_info.py @@ -13,6 +13,10 @@ def doSymInfo(mapPath: Path, symName: str) -> int: + if not mapPath.exists(): + print(f"Could not find mapfile at '{mapPath}'") + return 1 + mapFile = mapfile.MapFile() mapFile.readMapFile(mapPath) diff --git a/src/mapfile_parser/frontends/symbol_sizes_csv.py b/src/mapfile_parser/frontends/symbol_sizes_csv.py index 8105d78..e60566e 100644 --- a/src/mapfile_parser/frontends/symbol_sizes_csv.py +++ b/src/mapfile_parser/frontends/symbol_sizes_csv.py @@ -12,6 +12,10 @@ def doSymbolSizesCsv(mapPath: Path, outputPath: Path|None, filterSection: str|None=None, sameFolder: bool=False, symbolsSummary: bool=False, allFiles: bool=False) -> int: + if not mapPath.exists(): + print(f"Could not find mapfile at '{mapPath}'") + return 1 + mapFile = mapfile.MapFile() mapFile.readMapFile(mapPath) diff --git a/src/mapfile_parser/frontends/upload_frogress.py b/src/mapfile_parser/frontends/upload_frogress.py index c58b739..0b84b58 100644 --- a/src/mapfile_parser/frontends/upload_frogress.py +++ b/src/mapfile_parser/frontends/upload_frogress.py @@ -53,6 +53,10 @@ def uploadEntriesToFrogress(entries: dict[str, int], category: str, url: str, ap def doUploadFrogress(mapPath: Path, asmPath: Path, nonmatchingsPath: Path, project: str, version: str, category: str, baseurl: str, apikey: str|None=None, verbose: bool=False) -> int: + if not mapPath.exists(): + print(f"Could not find mapfile at '{mapPath}'") + return 1 + totalStats, progressPerFolder = progress.getProgress(mapPath, asmPath, nonmatchingsPath) entries: dict[str, int] = getFrogressEntriesFromStats(totalStats, progressPerFolder, verbose) From 8463bfc14e2f5fd94316cd808f7aff1d82968c74 Mon Sep 17 00:00:00 2001 From: angie Date: Fri, 26 Jan 2024 12:22:16 -0300 Subject: [PATCH 2/3] version bump --- CHANGELOG.md | 3 +++ Cargo.toml | 2 +- README.md | 4 ++-- pyproject.toml | 2 +- src/mapfile_parser/__init__.py | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e6bc12..dba7c3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.3.3] - 2024-01-26 + ### Changed - Frontend scripts now give a better error if the mapfile does not exist. @@ -305,6 +307,7 @@ Full changes: "] description = "Map file parser library focusing decompilation projects" diff --git a/README.md b/README.md index 00dfdfe..309878a 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ If you use a `requirements.txt` file in your repository, then you can add this library with the following line: ```txt -mapfile_parser>=2.3.2,<3.0.0 +mapfile_parser>=2.3.3,<3.0.0 ``` #### Development version @@ -74,7 +74,7 @@ cargo add mapfile_parser Or add the following line manually to your `Cargo.toml` file: ```toml -mapfile_parser = "2.3.2" +mapfile_parser = "2.3.3" ``` ## Versioning and changelog diff --git a/pyproject.toml b/pyproject.toml index 6e05b0c..b13dac5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ [project] name = "mapfile_parser" -version = "2.3.2" +version = "2.3.3" description = "Map file parser library focusing decompilation projects" readme = "README.md" requires-python = ">=3.7" diff --git a/src/mapfile_parser/__init__.py b/src/mapfile_parser/__init__.py index b51d99b..a2028d4 100644 --- a/src/mapfile_parser/__init__.py +++ b/src/mapfile_parser/__init__.py @@ -5,7 +5,7 @@ from __future__ import annotations -__version_info__ = (2, 3, 2) +__version_info__ = (2, 3, 3) __version__ = ".".join(map(str, __version_info__)) __author__ = "Decompollaborate" From 36dc89436e9b8d46e4c24c266c6981be5da6ac51 Mon Sep 17 00:00:00 2001 From: angie Date: Sun, 28 Jan 2024 12:37:11 -0300 Subject: [PATCH 3/3] version bump --- CHANGELOG.md | 4 ++-- Cargo.toml | 2 +- README.md | 4 ++-- pyproject.toml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dba7c3d..b75340a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [2.3.3] - 2024-01-26 +## [2.3.4] - 2024-01-26 ### Changed @@ -307,7 +307,7 @@ Full changes: "] description = "Map file parser library focusing decompilation projects" diff --git a/README.md b/README.md index 309878a..2f62b97 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ If you use a `requirements.txt` file in your repository, then you can add this library with the following line: ```txt -mapfile_parser>=2.3.3,<3.0.0 +mapfile_parser>=2.3.4,<3.0.0 ``` #### Development version @@ -74,7 +74,7 @@ cargo add mapfile_parser Or add the following line manually to your `Cargo.toml` file: ```toml -mapfile_parser = "2.3.3" +mapfile_parser = "2.3.4" ``` ## Versioning and changelog diff --git a/pyproject.toml b/pyproject.toml index b13dac5..c2d52ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ [project] name = "mapfile_parser" -version = "2.3.3" +version = "2.3.4" description = "Map file parser library focusing decompilation projects" readme = "README.md" requires-python = ">=3.7"