-
-
Notifications
You must be signed in to change notification settings - Fork 34k
gh-69405: Add check for idle's help.html to CI #143742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
075a069
7dbf673
571ff81
c8a5cc0
471961e
0f91167
f0b9c5f
9d33116
45e7f69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,12 @@ jobs: | |
| --fail-if-regression \ | ||
| --fail-if-improved \ | ||
| --fail-if-new-news-nit | ||
| - name: 'Upload built idle.html' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: idle-html | ||
| path: Doc/build/html/library/idle.html | ||
StanFromIreland marked this conversation as resolved.
Show resolved
Hide resolved
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer passing |
||
| retention-days: 1 | ||
|
|
||
| # Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release | ||
| doctest: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Reusable check IDLE help | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| permissions: {} | ||
|
|
||
| env: | ||
| FORCE_COLOR: 1 | ||
|
|
||
| jobs: | ||
| check-idle-doc-sync: | ||
| name: 'Check if IDLE help needs regenerating' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| persist-credentials: false | ||
| - name: 'Download built idle.html' | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: idle-html | ||
| path: Doc/build/html/library | ||
| - name: 'Set up Python' | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3' | ||
| - name: 'Regenerate Lib/idlelib/help.html' | ||
| run: python ../Tools/build/generate_idle_help.py | ||
StanFromIreland marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| working-directory: Doc | ||
| - name: 'Check for changes' | ||
| run: | | ||
| git diff --exit-code Lib/idlelib/help.html || { | ||
| echo "Lib/idlelib/help.html is not up to date." | ||
| echo "Run make idlehelp in the Doc directory." | ||
| exit 1 | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this stay in Lib/idlelib/help.py?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We would have to build CPython if we want to be able to modify it, that's not particularly fast?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the purported need to move copy_strip (and fairly strongly prefer not to). What is 'it'? I cannot imagine a need to modify the code just to check the file modification state. I am not sure about adding a new make target. Currently, I update help.html (either in a .bat or manually) with
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we don’t want to move, currently it is useless where it is with a system python, as the paths are relative to the location of the installed idlelib, and the Doc folder is not in /usr/lib/ or somewhere like that. We could update the function, but then we would have to wait for the next 3.14 release (and then for actions to pick it up) before we could it. The other option is building CPython, but that would just make the check over 50x times slower. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| """Copy the text part of idle.html to idlelib/help.html while stripping trailing whitespace. | ||
|
|
||
| Files with trailing whitespace cannot be pushed to the git cpython | ||
| repository. help.html is regenerated, after | ||
| editing idle.rst on the master branch, with, in the Doc directory | ||
| make idlehelp | ||
| Check build/html/library/idle.html, the help.html diff, and the text | ||
| displayed by Help => IDLE Help. Add a blurb and create a PR. | ||
|
|
||
| It can be worthwhile to occasionally generate help.html without | ||
| touching idle.rst. Changes to the master version and to the doc | ||
| build system may result in changes that should not change | ||
| the displayed text, but might break HelpParser. | ||
|
|
||
| As long as master and maintenance versions of idle.rst remain the | ||
| same, help.html can be backported. The internal Python version | ||
| number is not displayed. If maintenance idle.rst diverges from | ||
| the master version, then instead of backporting help.html from | ||
| master, repeat the procedure above to generate a maintenance | ||
| version. | ||
| """ | ||
|
|
||
| def copy_strip(): | ||
| src = 'build/html/library/idle.html' | ||
| dst = '../Lib/idlelib/help.html' | ||
StanFromIreland marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| with open(src, encoding="utf-8") as inn, open(dst, 'w', encoding="utf-8") as out: | ||
| copy = False | ||
| for line in inn: | ||
| if '<div class="clearer">' in line: | ||
| break | ||
| if '<section id="idle">' in line: | ||
| copy = True | ||
| if copy: | ||
| out.write(line.strip() + '\n') | ||
|
|
||
| print(f'{src} copied to {dst}') | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| copy_strip() | ||
Uh oh!
There was an error while loading. Please reload this page.