From 281ddb8678eb915d4531b7651f549f4a0c086c63 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 3 Dec 2019 10:45:42 +0530 Subject: [PATCH] Make the name of the html syntax highlighter module more explicit Avoids name collisions with the stdlib html module in python3 --- setup/extensions.json | 2 +- src/calibre/constants.py | 2 +- src/calibre/gui2/tweak_book/editor/syntax/html.c | 10 +++++----- src/calibre/gui2/tweak_book/editor/syntax/html.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/setup/extensions.json b/setup/extensions.json index 3035ab4a32..2474973b2a 100644 --- a/setup/extensions.json +++ b/setup/extensions.json @@ -52,7 +52,7 @@ "lib_dirs": "!openssl_lib_dirs" }, { - "name": "html", + "name": "html_syntax_highlighter", "sources": "calibre/gui2/tweak_book/editor/syntax/html.c" }, { diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 16a1f0c46e..c25aca48cc 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -174,7 +174,7 @@ class Plugins(collections.Mapping): 'speedup', 'html_as_json', 'unicode_names', - 'html', + 'html_syntax_highlighter', 'hyphen', 'freetype', 'imageops', diff --git a/src/calibre/gui2/tweak_book/editor/syntax/html.c b/src/calibre/gui2/tweak_book/editor/syntax/html.c index 3e750d102e..c2ca6883f4 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/html.c +++ b/src/calibre/gui2/tweak_book/editor/syntax/html.c @@ -486,7 +486,7 @@ static PyMethodDef html_methods[] = { #define INITERROR return NULL static struct PyModuleDef html_module = { /* m_base */ PyModuleDef_HEAD_INIT, - /* m_name */ "html", + /* m_name */ "html_syntax_highlighter", /* m_doc */ "Speedups for the html syntax highlighter", /* m_size */ -1, /* m_methods */ html_methods, @@ -496,12 +496,12 @@ static struct PyModuleDef html_module = { /* m_free */ 0, }; -CALIBRE_MODINIT_FUNC PyInit_html(void) { +CALIBRE_MODINIT_FUNC PyInit_html_syntax_highlighter(void) { PyObject *temp, *mod = PyModule_Create(&html_module); #else #define INITERROR return -CALIBRE_MODINIT_FUNC inithtml(void) { - PyObject *temp, *mod = Py_InitModule3("html", html_methods, +CALIBRE_MODINIT_FUNC inithtml_syntax_highlighter(void) { + PyObject *temp, *mod = Py_InitModule3("html_syntax_highlighter", html_methods, "Speedups for the html syntax highlighter"); #endif @@ -544,4 +544,4 @@ CALIBRE_MODINIT_FUNC inithtml(void) { #if PY_MAJOR_VERSION >= 3 return mod; #endif -} \ No newline at end of file +} diff --git a/src/calibre/gui2/tweak_book/editor/syntax/html.py b/src/calibre/gui2/tweak_book/editor/syntax/html.py index a5f1200764..90f14311e4 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/html.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/html.py @@ -64,7 +64,7 @@ def refresh_spell_check_status(): from calibre.constants import plugins -_speedup = plugins['html'][0] +_speedup = plugins['html_syntax_highlighter'][0] if _speedup is not None: Tag = _speedup.Tag bold_tags, italic_tags = _speedup.bold_tags, _speedup.italic_tags