Repository navigation
Conversation
|
Replacement for #2321. Same refactor — the diff between the two PRs is Behavior fixes vs #2321:
Plus review items: proper branch, sign-off, conventional subjects. The refactor against upstream is unchanged from #2321. Not going to |
|
The app needs for a serious reorganization setup. Perhaps rework of the frontend. Nothing crazy, just upgrade Tkinter to the new version 9 and apply the new default skins will do wonders. |
|
In 12 hours I'll start working on my job again so I'm going to leave it for now but the experience have been good. Love to learn reducing cognitive complexity since always shows hidden bugs. |
|
The #1761 already upgrades to python 3.15.2 and Tkinter 9 |
|
Can you please rebase this on master? |
…ecks - crawl_ardupilot_wiki.py: split remove_duplicates into per-rule predicates and find_all_links into guard helpers, dropping both functions from radon C to A/B; logging and exception-handling cleanup. - regenerate_app_screenshots_fully_automated.py: replace _require_attr with inline None-checks so mypy can narrow types; separate handler variables to avoid incompatible Callable reuse. - download_motor_diagrams.py: logging cleanup. Signed-off-by: GA. <igoutta@users.noreply.github.com>
…talog The process_configuration_steps refactor split the function into _add_text_fields/_add_jump_messages/_add_change_reasons but dropped the instructions_popup branch, so those strings stopped reaching the catalog. Add _add_instructions_popup and call it in the same position as before the refactor. Signed-off-by: GA. <igoutta@users.noreply.github.com>
bf23e0e to
9503980
Compare
| except (httpx2.HTTPError, httpx2.InvalidURL) as e: | ||
| logging.error("Network error crawling %s: %s", current_url, str(e)) | ||
| except (httpx2.HTTPError, httpx2.InvalidURL): | ||
| logging.exception("Network error crawling %s:", current_url) | ||
| broken_urls.add(current_url) | ||
| visited_urls.discard(current_url) | ||
| except (KeyError, ValueError) as e: | ||
| logging.error("URL processing error for %s: %s", current_url, str(e)) | ||
| except (KeyError, ValueError): | ||
| logging.exception("URL processing error for %s:", current_url) |
There was a problem hiding this comment.
The : after the %s seams superfulous
|
|
||
| except OSError: | ||
| logger.exception("Failed to download %s: ", filename) | ||
| logger.exception("Failed to download %s:", filename) |
There was a problem hiding this comment.
The : after the %s seams superfluous
Signed-off-by: GA. <igoutta@users.noreply.github.com>
Coverage Report for CI Build 44823164767Warning 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: 96.142%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats💛 - Coveralls |
Description
Refactor
scripts/generate_pdef.xml_metadata.pyandscripts/regenerate_app_screenshots_fully_automated.pyfor readability andconsistent logging, and add two behavior changes to pdef regeneration
(
--git-tagprovenance, non-zero exit on failures).Addresses the six blocking items from review on #2321.
Summary of changes
scripts/generate_pdef.xml_metadata.pyBehavior
--git-tagtoparam_parse.pyso the emitter writes the tagprovenance comment itself. The previous post-processing step (reparse
XML with
lxml, insert a comment at line 3, rewrite) is removed, andthe
lxmlruntime dependency is dropped fromensure_dependencies.param_parse.pywithcheck=False. The script exits with thenumber of validation warnings, not a boolean, and writes
apm.pdef.xmlbefore exiting. Treating non-zero as fatal discardedvalid output. Now: warn, log stdout/stderr at DEBUG, keep the file.
apm.pdef.xmlbefore generation so the post-generationexistence check can't copy an artifact we didn't produce.
(captured with
git rev-parse HEADbeforegit checkout). Previouslythe tree was left on the last tag.
mainreturns non-zero when any per-version generation or any rsyncfails. Previously failures were swallowed and the process exited 0.
Refactor
_should_skip_version,_generate_pdefs_for_vehicle,_vehicle_dir,_redact_rsync_cmd.get_vehicle_tagsno longeros.chdirs; usescwd=ardupilot_diranda regex filter (
^\w+-\d+\.\d+\.\d+$) so multi-digit minors like4.10.xaren't silently dropped by the old single-digit pattern.print→logger.*throughout;logger.exceptionused for errorpaths so the traceback is captured.
timeout=to all subprocess calls (120s forgit tag, 60s forgit rev-parse, 300s forgit checkout, 600s forparam_parse.py,1800s for
rsync)._redact_rsync_cmdstripsuser:pass@from rsync URLs before logging,so the DEBUG argv line is credential-safe if the URL ever changes.
if version[0] == ... continueskip rulesinto
_should_skip_version(version) -> boolusing(major, minor) < (4, 6).The old
AP_Periph3.x exception was unreachable (AP_Periphisn't inVEHICLE_TYPES) and is dropped.scripts/regenerate_app_screenshots_fully_automated.pyRefactor
capture_target: dict-based dispatch for_SIMPLE_ACTIONSand_VEHICLE_DIR_ACTIONS, frozenset for_VEHICLE_OPENER_HIGHLIGHT, thena
matchstatement for the remaining cases.CaptureTargetattributes (current_file,gui_complexity,variant) are copied into locals and checked withis Nonebeforeuse, so mypy narrows at each call site.
_required_widget_box(parent, predicate, error_msg)consolidatesthe "find descendant, raise if missing, return screen box" pattern
used by six call sites (
_vehicle_opener_highlight_box× 4,_find_template_browse_button,_find_create_button).patch.object(tk.Tk, "mainloop", lambda _self: None)→return_value=None.except Exception as exc:+logging.exception("...: %s", exc)→except Exception:+logging.exception("..."), sincelogger.exceptionalready includes the exception.Testing
mypy scripts/regenerate_app_screenshots_fully_automated.pycleanpytestunaffected (scripts-only)generate_pdef.xml_metadata.pyon a pre-4.6 tag(skipped) and a 4.7 tag (generated,
--git-tagcomment present,exit code 0)