Make the name of the html syntax highlighter module more explicit

Avoids name collisions with the stdlib html module in python3
This commit is contained in:
Kovid Goyal 2019-12-03 10:45:42 +05:30
parent 9b777491ce
commit 281ddb8678
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 8 additions and 8 deletions

View File

@ -52,7 +52,7 @@
"lib_dirs": "!openssl_lib_dirs" "lib_dirs": "!openssl_lib_dirs"
}, },
{ {
"name": "html", "name": "html_syntax_highlighter",
"sources": "calibre/gui2/tweak_book/editor/syntax/html.c" "sources": "calibre/gui2/tweak_book/editor/syntax/html.c"
}, },
{ {

View File

@ -174,7 +174,7 @@ class Plugins(collections.Mapping):
'speedup', 'speedup',
'html_as_json', 'html_as_json',
'unicode_names', 'unicode_names',
'html', 'html_syntax_highlighter',
'hyphen', 'hyphen',
'freetype', 'freetype',
'imageops', 'imageops',

View File

@ -486,7 +486,7 @@ static PyMethodDef html_methods[] = {
#define INITERROR return NULL #define INITERROR return NULL
static struct PyModuleDef html_module = { static struct PyModuleDef html_module = {
/* m_base */ PyModuleDef_HEAD_INIT, /* m_base */ PyModuleDef_HEAD_INIT,
/* m_name */ "html", /* m_name */ "html_syntax_highlighter",
/* m_doc */ "Speedups for the html syntax highlighter", /* m_doc */ "Speedups for the html syntax highlighter",
/* m_size */ -1, /* m_size */ -1,
/* m_methods */ html_methods, /* m_methods */ html_methods,
@ -496,12 +496,12 @@ static struct PyModuleDef html_module = {
/* m_free */ 0, /* m_free */ 0,
}; };
CALIBRE_MODINIT_FUNC PyInit_html(void) { CALIBRE_MODINIT_FUNC PyInit_html_syntax_highlighter(void) {
PyObject *temp, *mod = PyModule_Create(&html_module); PyObject *temp, *mod = PyModule_Create(&html_module);
#else #else
#define INITERROR return #define INITERROR return
CALIBRE_MODINIT_FUNC inithtml(void) { CALIBRE_MODINIT_FUNC inithtml_syntax_highlighter(void) {
PyObject *temp, *mod = Py_InitModule3("html", html_methods, PyObject *temp, *mod = Py_InitModule3("html_syntax_highlighter", html_methods,
"Speedups for the html syntax highlighter"); "Speedups for the html syntax highlighter");
#endif #endif

View File

@ -64,7 +64,7 @@ def refresh_spell_check_status():
from calibre.constants import plugins from calibre.constants import plugins
_speedup = plugins['html'][0] _speedup = plugins['html_syntax_highlighter'][0]
if _speedup is not None: if _speedup is not None:
Tag = _speedup.Tag Tag = _speedup.Tag
bold_tags, italic_tags = _speedup.bold_tags, _speedup.italic_tags bold_tags, italic_tags = _speedup.bold_tags, _speedup.italic_tags