Repository navigation
Scripts improvements - #2327
Scripts improvements#2327
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
urllib.request.urlretrieve()commonly raisesurllib.error.URLErrorfor network failures; after… · New The comment says these are \"Not yet versioned\" on the autotest server, but the function now (and… · New The exception log message ends with a dangling:and doesn't add any extra context beyond what… · New Theselogger.exception(...)format strings include a trailing colon (%s:). Since… · New
What changed in this PR
This PR improves various scripts and tests, notably updating how parameter metadata URLs are selected based on firmware version (historical vs modern upstream locations) and refactoring script internals for clearer behavior and logging.
Changes:
- Update parameter metadata URL selection to use
firmware.ardupilot.orgfor releases >= 4.7.0 and keep legacy URLs for older releases, with expanded unit tests. - Refactor screenshot regeneration and translation-extraction scripts for clearer flow and improved exception logging.
- Remove legacy workflow/script related to generating and uploading
apm.pdef.xmlmetadata.
| File | Description |
|---|---|
| tests/test_backend_filesystem.py | Expands test to validate metadata source URL across legacy/current releases. |
| tests/test_annotate_params.py | Adds coverage for version-boundary URL selection and vehicle directory mapping. |
| ardupilot_methodic_configurator/annotate_params.py | Implements upstream URL switch at 4.7.0 and adds firmware base URL constant. |
| scripts/update_configuration_steps_translation.py | Refactors extraction helpers and switches to logger.exception for full tracebacks. |
| scripts/regenerate_app_screenshots_fully_automated.py | Reduces duplication via helper functions/constants and improves error reporting. |
| scripts/verify_wheel_install.py | Improves RuntimeError message clarity when module import escapes venv. |
| scripts/download_motor_diagrams.py | Adjusts exception handling/logging for download failures. |
| scripts/batch_convert_motor_diagrams.py | Simplifies error handling by using logger.exception. |
| scripts/calculate_code_statistics.py | Removes redundant accumulator variable for generated app lines. |
| CUSTOMIZING_CONFIGURATION_STEPS.md | Documents upstream metadata locations and URL formats by firmware version. |
| ARCHITECTURE_3_directory_selection.md | Documents shared URL selection behavior and version split. |
| scripts/generate_pdef.xml_metadata.py | Removes legacy metadata generation/upload script. |
| .github/workflows/generate_apm.pdef.xml.yml | Removes workflow that ran the removed metadata generation script. |
Review effort: Lite
| except OSError: | ||
| logger.exception("Failed to download %s: ", filename) |
| # Not yet versioned in the https://autotest.ardupilot.org/Parameters server | ||
| "AP_Periph": "versioned/Periph/stable-", | ||
| "Blimp": "versioned/Blimp/stable-", | ||
| "Heli": "versioned/Copter/stable-", | ||
| "SITL": "versioned/SITL/stable-", | ||
| "AP_Periph": "Periph", | ||
| "Blimp": "Blimp", | ||
| "Heli": "Copter", | ||
| "SITL": "SITL", |
|
|
||
| traceback.print_exc() | ||
| except (OSError, RuntimeError, ValueError): | ||
| logger.exception("Error during conversion: ") |
| logger.exception("Error parsing %s:", config_file) | ||
| except Exception: # pylint: disable=broad-exception-caught | ||
| logger.exception("Error processing %s:", config_file) |
ArduPilot owns parameter metadata generation and publication. Remove the Methodic Configurator publisher and consume upstream release files while simplifying script maintenance and preserving translation input. Parameter metadata: - Remove the duplicate metadata generator and its upload workflow. - Download releases below 4.7.2 from the autotest versioned parameter directory, and releases from 4.7.2 onward from the firmware release's __METADATA__/apm.pdef.xml directory. - Compare numeric major, minor, and patch components at the cutoff. - Map vehicle names to the correct directories on each server. - Preserve complete major.minor versions in ParameterRepository fallback URLs, including Plane 3.10 and Copter 4.10. - Add snapshot fallbacks for Tracker, AP_Periph, and Blimp. - Skip unavailable optional snapshots, including SITL, without preventing primary downloads or cached metadata from loading. - Document upstream generation, publication layouts, cache precedence, and fallback policies. Script maintenance: - Extract configuration-step translation helpers while retaining popup messages, jump messages, and conditional change reasons. - Consolidate screenshot widget lookup and bounding-box handling. - Group screenshot handlers by signature and retain explicit checks for optional target fields. - Use logger.exception instead of duplicate exception formatting and manual traceback printing. - Remove an unused code-statistics accumulator. - Improve diagnostics for wheel modules imported outside the isolated environment. Validation: - 264 affected tests pass, covering metadata routing, version boundaries, fallback downloads, cached metadata, translations, and packaging. - All 32 screenshot targets retain their handler and arguments. - Translation extraction preserves all 463 existing strings. - Pre-commit, Markdown lint, and targeted static checks pass. - Full screenshot regeneration and hardware tests were not run. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
69a9436 to
755268e
Compare
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head This refactor of the metadata URL selection and helper scripts looks correct at 755268e, and the 4.7.2 cutoff matches what the autotest and firmware servers publish today. The only open item is cosmetic. Should fix
Minor (1)
Copilot's concern that Not fully reviewed: real GUI screenshot regeneration, end-to-end motor-diagram download/conversion, frozen/PyInstaller builds, the full lint/type-check suite and upstream CI (still pending). |
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Coverage Report for CI Build 41651882184Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Warning No base build found for commit Coverage: 94.818%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats💛 - Coveralls |



Description
This is a replacement for #2321 with a better branch name and some fixes
Checklist
git commit --signoff)Testing
Describe how you tested these changes: