From 42d8790379dc0902e1dc8d02ddaff48a8893c58a Mon Sep 17 00:00:00 2001 From: Sakshay Mahna Date: Wed, 20 Aug 2025 17:31:25 +0530 Subject: [PATCH 1/3] Add default plugin directory #58 --- parse.py | 9 +++++++-- .../custom_handlers/launch_config_as_bool_handler.py | 0 .../custom_handlers/rewritten_yaml_handler.py | 0 parser/tests/real_cases/launch_files/.launchmap | 2 +- parser/tests/test_real_launch_files.py | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) rename parser/{tests/real_cases/launch_files => }/custom_handlers/launch_config_as_bool_handler.py (100%) rename parser/{tests/real_cases/launch_files => }/custom_handlers/rewritten_yaml_handler.py (100%) diff --git a/parse.py b/parse.py index e3d8fe8..ed600ab 100644 --- a/parse.py +++ b/parse.py @@ -12,24 +12,29 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import sys import json import argparse from parser.entrypoint.user_interface import parse_and_format_launch_file from parser.plugin_loader import load_user_handlers_from_directory +DEFAULT_PLUGIN_DIR = os.path.join(os.path.dirname(__file__), "parser", "custom_handler") def main(): parser = argparse.ArgumentParser(description="Parse a ROS2 launch file.") parser.add_argument("launch_file", help="Path to launch file to parse.") parser.add_argument( - "--plugin-dir", help="Directory containing user-defined custom handlers." + "--plugin-dir", help="Directory containing user-defined custom handlers.", + default = DEFAULT_PLUGIN_DIR ) args = parser.parse_args() - if args.plugin_dir: + if os.path.isdir(args.plugin_dir): load_user_handlers_from_directory(args.plugin_dir) + else: + print(f"Warning: Plugin directory not found: {args.plugin_dir}") try: result = parse_and_format_launch_file(args.launch_file) diff --git a/parser/tests/real_cases/launch_files/custom_handlers/launch_config_as_bool_handler.py b/parser/custom_handlers/launch_config_as_bool_handler.py similarity index 100% rename from parser/tests/real_cases/launch_files/custom_handlers/launch_config_as_bool_handler.py rename to parser/custom_handlers/launch_config_as_bool_handler.py diff --git a/parser/tests/real_cases/launch_files/custom_handlers/rewritten_yaml_handler.py b/parser/custom_handlers/rewritten_yaml_handler.py similarity index 100% rename from parser/tests/real_cases/launch_files/custom_handlers/rewritten_yaml_handler.py rename to parser/custom_handlers/rewritten_yaml_handler.py diff --git a/parser/tests/real_cases/launch_files/.launchmap b/parser/tests/real_cases/launch_files/.launchmap index bb01296..1888526 100644 --- a/parser/tests/real_cases/launch_files/.launchmap +++ b/parser/tests/real_cases/launch_files/.launchmap @@ -1,3 +1,3 @@ { - "pluginDir": "/Users/sakshaymahna/Documents/Robotics/ROSDocker/launchmap/parser/tests/real_cases/launch_files/custom_handlers" + "pluginDir": "/Users/sakshaymahna/Documents/Robotics/ROSDocker/launchmap/parser/custom_handlers" } \ No newline at end of file diff --git a/parser/tests/test_real_launch_files.py b/parser/tests/test_real_launch_files.py index 6a9a841..04a5d1f 100644 --- a/parser/tests/test_real_launch_files.py +++ b/parser/tests/test_real_launch_files.py @@ -23,7 +23,7 @@ BASE_DIR = os.path.dirname(__file__) INPUT_DIR = os.path.join(BASE_DIR, "real_cases/launch_files") OUTPUT_DIR = os.path.join(BASE_DIR, "real_cases/expected_outputs") -PLUGIN_DIR = os.path.join(BASE_DIR, "real_cases/launch_files/custom_handlers") +PLUGIN_DIR = os.path.join(BASE_DIR, "../custom_handlers") @pytest.mark.parametrize("filename", [f for f in os.listdir(INPUT_DIR) if f.endswith(".py")]) From 0fb7fe7fdfdb1766d96389a6f4f5805e042e7506 Mon Sep 17 00:00:00 2001 From: Sakshay Mahna Date: Wed, 20 Aug 2025 17:36:58 +0530 Subject: [PATCH 2/3] Fix extension test error --- parse.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/parse.py b/parse.py index ed600ab..23b51d8 100644 --- a/parse.py +++ b/parse.py @@ -33,8 +33,6 @@ def main(): if os.path.isdir(args.plugin_dir): load_user_handlers_from_directory(args.plugin_dir) - else: - print(f"Warning: Plugin directory not found: {args.plugin_dir}") try: result = parse_and_format_launch_file(args.launch_file) From 4d5d6d6a5ae7fb99d12fb1d7d31a612440957216 Mon Sep 17 00:00:00 2001 From: Sakshay Mahna Date: Wed, 20 Aug 2025 17:42:06 +0530 Subject: [PATCH 3/3] Update version to 0.1.10 --- CHANGELOG | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index bbfa8a3..78e188a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/). --- +## [0.1.10] - 2025-08-20 + +### Added +- Add a default plugin directory in case nothing is passed + ## [0.1.9] - 2025-08-12 ### Added diff --git a/package-lock.json b/package-lock.json index b30455b..e06412b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "launchmap", - "version": "0.1.9", + "version": "0.1.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "launchmap", - "version": "0.1.9", + "version": "0.1.10", "license": "Apache-2.0", "dependencies": { "which": "^5.0.0" diff --git a/package.json b/package.json index f78299b..315385a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "launchmap", "displayName": "LaunchMap", "description": "Visualize ROS2 Launch Files", - "version": "0.1.9", + "version": "0.1.10", "publisher": "kodorobotics", "icon": "assets/launchmap-logo.png", "bugs": {