-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
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
Open
StanFromIreland
wants to merge
9
commits into
python:main
Choose a base branch
from
StanFromIreland:idle-help-check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
075a069
Add idle help check to CI
StanFromIreland 7dbf673
Misc updates
StanFromIreland 571ff81
Fix check
StanFromIreland c8a5cc0
Merge branch 'main' into idle-help-check
StanFromIreland 471961e
Apply suggestions from Hugo
StanFromIreland 0f91167
Only run if IDLE docs are modified
StanFromIreland f0b9c5f
Review
StanFromIreland 9d33116
Remove from Makefile.pre.in
StanFromIreland 45e7f69
Review
StanFromIreland File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: Reusable check IDLE help | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| idle-html-artifact-id: | ||
| description: 'Artifact ID for the built idle.html' | ||
| required: true | ||
| type: string | ||
|
|
||
| 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: | ||
| artifact-ids: ${{ inputs.idle-html-artifact-id }} | ||
| 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: make idlehelp | ||
| 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 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| """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. | ||
| """ | ||
|
|
||
| from os.path import abspath, dirname, join | ||
|
|
||
|
|
||
| def copy_strip(): | ||
| src = join(abspath(dirname(dirname(dirname(__file__)))), | ||
| 'Doc', 'build', 'html', 'library', 'idle.html') | ||
| dst = join(abspath(dirname(dirname(dirname(__file__)))), | ||
| 'Lib', 'idlelib', 'help.html') | ||
|
|
||
| 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() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.