Closed AstralShadow closed 2 years ago
The Python requirements file specifies premailer version 3.7, so that's the one that should be used.
My bad, i'm new to python and didn't knew about requirements.txt
FWIW, since for openSUSE Tumbleweed we have already moved to premailer 3.10, we needed a patch to get cppreference packages building. Here is what I have committed to the openSUSE package build [1]. Just in case this helps anyone else.
Index: cppreference-doc-20220730/commands/preprocess_cssless.py
===================================================================
--- cppreference-doc-20220730.orig/commands/preprocess_cssless.py
+++ cppreference-doc-20220730/commands/preprocess_cssless.py
@@ -72,8 +72,16 @@ def preprocess_html_merge_css(root, src_
with warnings.catch_warnings():
warnings.simplefilter("ignore")
- premailer = Premailer(root, base_url=src_path,
- disable_link_rewrites=True, remove_classes=True)
+ try:
+ # Premailer >= 3.9
+ premailer = Premailer(root, base_url=src_path,
+ disable_link_rewrites=True, remove_classes=True,
+ allow_loading_external_files=True)
+ except:
+ # Premailer < 3.9
+ premailer = Premailer(root, base_url=src_path,
+ disable_link_rewrites=True, remove_classes=True)
+
root = premailer.transform().getroot()
return output.getvalue()
[1] https://build.opensuse.org/package/show/openSUSE:Factory/cppreference-doc
That's a nice patch, supports both old and new versions :)
Premailer 3.9 added a constructor argument with default value False that causes premailer.premailer.ExternalFileLoadingError when doing "make doc_qch"
From their README.md:
Enabling it at commands/preprocess_cssless.py:77 fixes this, but it starts throwing an "unexpected keyword argument" exception when run with premailer <3.9