| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ jobs: | |||
| 21 | 21 | - name: Check for source changes | |
| 22 | 22 | id: check | |
| 23 | 23 | run: | | |
| 24 | - if [ -z "GITHUB_BASE_REF" ]; then | ||
| 24 | + if [ -z "$GITHUB_BASE_REF" ]; then | ||
| 25 | 25 | echo '::set-output name=run_tests::true' | |
| 26 | 26 | else | |
| 27 | 27 | git fetch origin $GITHUB_BASE_REF --depth=1 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,7 +35,8 @@ | |||
| 35 | 35 | import suspicious | |
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | - ISSUE_URI = 'https://bugs.python.org/issue%s' | ||
| 38 | + ISSUE_URI = 'https://bugs.python.org/issue?@action=redirect&bpo=%s' | ||
| 39 | + GH_ISSUE_URI = 'https://github.com/python/cpython/issues/%s' | ||
| 39 | 40 | SOURCE_URI = 'https://github.com/python/cpython/tree/3.7/%s' | |
| 40 | 41 | ||
| 41 | 42 | # monkey-patch reST parser to disable alphabetic and roman enumerated lists | |
@@ -81,11 +82,33 @@ def new_depart_literal_block(self, node): | |||
| 81 | 82 | ||
| 82 | 83 | def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): | |
| 83 | 84 | issue = utils.unescape(text) | |
| 85 | + # sanity check: there are no bpo issues within these two values | ||
| 86 | + if 47261 < int(issue) < 400000: | ||
| 87 | + msg = inliner.reporter.error(f'The BPO ID {text!r} seems too high -- ' | ||
| 88 | + 'use :gh:`...` for GitHub IDs', line=lineno) | ||
| 89 | + prb = inliner.problematic(rawtext, rawtext, msg) | ||
| 90 | + return [prb], [msg] | ||
| 84 | 91 | text = 'bpo-' + issue | |
| 85 | 92 | refnode = nodes.reference(text, text, refuri=ISSUE_URI % issue) | |
| 86 | 93 | return [refnode], [] | |
| 87 | 94 | ||
| 88 | 95 | ||
| 96 | + # Support for marking up and linking to GitHub issues | ||
| 97 | + | ||
| 98 | + def gh_issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): | ||
| 99 | + issue = utils.unescape(text) | ||
| 100 | + # sanity check: all GitHub issues have ID >= 32426 | ||
| 101 | + # even though some of them are also valid BPO IDs | ||
| 102 | + if int(issue) < 32426: | ||
| 103 | + msg = inliner.reporter.error(f'The GitHub ID {text!r} seems too low -- ' | ||
| 104 | + 'use :issue:`...` for BPO IDs', line=lineno) | ||
| 105 | + prb = inliner.problematic(rawtext, rawtext, msg) | ||
| 106 | + return [prb], [msg] | ||
| 107 | + text = 'gh-' + issue | ||
| 108 | + refnode = nodes.reference(text, text, refuri=GH_ISSUE_URI % issue) | ||
| 109 | + return [refnode], [] | ||
| 110 | + | ||
| 111 | + | ||
| 89 | 112 | # Support for linking to Python source files easily | |
| 90 | 113 | ||
| 91 | 114 | def source_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): | |
@@ -286,7 +309,8 @@ def run(self): | |||
| 286 | 309 | ||
| 287 | 310 | # Support for including Misc/NEWS | |
| 288 | 311 | ||
| 289 | - issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)') | ||
| 312 | + issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)', re.I) | ||
| 313 | + gh_issue_re = re.compile('(?:gh-issue-|gh-)([0-9]+)', re.I) | ||
| 290 | 314 | whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$") | |
| 291 | 315 | ||
| 292 | 316 | ||
@@ -313,8 +337,9 @@ def run(self): | |||
| 313 | 337 | text = 'The NEWS file is not available.' | |
| 314 | 338 | node = nodes.strong(text, text) | |
| 315 | 339 | return [node] | |
| 316 | - content = issue_re.sub(r'`bpo-\1 <https://bugs.python.org/issue\1>`__', | ||
| 317 | - content) | ||
| 340 | + content = issue_re.sub(r':issue:`\1`', content) | ||
| 341 | + # Fallback handling for the GitHub issue | ||
| 342 | + content = gh_issue_re.sub(r':gh:`\1`', content) | ||
| 318 | 343 | content = whatsnew_re.sub(r'\1', content) | |
| 319 | 344 | # remove first 3 lines as they are the main heading | |
| 320 | 345 | lines = ['.. default-role:: obj', ''] + content.splitlines()[3:] | |
@@ -430,6 +455,7 @@ def parse_pdb_command(env, sig, signode): | |||
| 430 | 455 | ||
| 431 | 456 | def setup(app): | |
| 432 | 457 | app.add_role('issue', issue_role) | |
| 458 | + app.add_role('gh', gh_issue_role) | ||
| 433 | 459 | app.add_role('source', source_role) | |
| 434 | 460 | app.add_directive('impl-detail', ImplementationDetail) | |
| 435 | 461 | app.add_directive('availability', Availability) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -289,7 +289,7 @@ by Nir Soffer. | |||
| 289 | 289 | ||
| 290 | 290 | .. | |
| 291 | 291 | ||
| 292 | - .. bpo: 321010 | ||
| 292 | + .. bpo: 32101 | ||
| 293 | 293 | .. date: 2017-11-29-00-42-47 | |
| 294 | 294 | .. nonce: -axD5l | |
| 295 | 295 | .. section: Library | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ Prevent ctypes crash when handling arrays in structs/unions. | |||
| 13 | 13 | .. nonce: 9TWMlz | |
| 14 | 14 | .. section: Library | |
| 15 | 15 | ||
| 16 | - Revert GH-15522, which introduces a regression in | ||
| 16 | + Revert PR 15522, which introduces a regression in | ||
| 17 | 17 | :meth:`mimetypes.guess_type` due to improper handling of filenames as urls. | |
| 18 | 18 | ||
| 19 | 19 | .. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -180,7 +180,7 @@ Remove obsolete check for `__args__` in bdb.Bdb.format_stack_entry. | |||
| 180 | 180 | .. section: Library | |
| 181 | 181 | ||
| 182 | 182 | The original fix for bpo-27657, "Fix urlparse() with numeric paths" | |
| 183 | - (GH-16839) included in 3.7.6, inadvertently introduced a behavior change | ||
| 183 | + (PR 16839) included in 3.7.6, inadvertently introduced a behavior change | ||
| 184 | 184 | that broke several third-party packages relying on the original undefined | |
| 185 | 185 | parsing behavior. The change is reverted in 3.7.7, restoring the behavior of | |
| 186 | 186 | 3.7.5 and earlier releases. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + Add a new ``gh`` role to the documentation to link to GitHub issues. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments