Skip to content

Commit

Permalink
Fix TypeError for missing required use_deprecated_html5lib with pip…
Browse files Browse the repository at this point in the history
… 22.

Keep compatible with earlier pip versions.
Fixes #598
  • Loading branch information
mauritsvanrees authored and gotcha committed Mar 2, 2022
1 parent 2a91e9f commit c024192
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions news/598.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix TypeError for missing required `use_deprecated_html5lib` with pip 22.
Keep compatible with earlier pip versions.
8 changes: 7 additions & 1 deletion src/zc/buildout/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,13 @@ def process_url(self, url, retrieve=False):
except TypeError:
html_page = HTMLPage(page, charset, base)

plinks = list(parse_links(html_page))
# https://github.com/buildout/buildout/issues/598
# use_deprecated_html5lib is a required addition in pip 22.
try:
plinks = parse_links(html_page, use_deprecated_html5lib=False)
except TypeError:
plinks = parse_links(html_page)
plinks = list(plinks)
pip_links = [l.url for l in plinks]

# --- END OF LOCAL CHANGES ---
Expand Down

0 comments on commit c024192

Please sign in to comment.