mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get the patience diff module compiling and loading
This commit is contained in:
parent
b98677d9b1
commit
0409241765
@ -89,6 +89,10 @@ extensions = [
|
|||||||
['calibre/utils/speedup.c'],
|
['calibre/utils/speedup.c'],
|
||||||
),
|
),
|
||||||
|
|
||||||
|
Extension('_patiencediff_c',
|
||||||
|
['calibre/utils/diff/_patiencediff_c.c'],
|
||||||
|
),
|
||||||
|
|
||||||
Extension('icu',
|
Extension('icu',
|
||||||
['calibre/utils/icu.c'],
|
['calibre/utils/icu.c'],
|
||||||
libraries=icu_libs,
|
libraries=icu_libs,
|
||||||
|
@ -141,6 +141,7 @@ class Plugins(collections.Mapping):
|
|||||||
'qt_hack',
|
'qt_hack',
|
||||||
'_regex',
|
'_regex',
|
||||||
'hunspell',
|
'hunspell',
|
||||||
|
'_patiencediff_c',
|
||||||
]
|
]
|
||||||
if iswindows:
|
if iswindows:
|
||||||
plugins.extend(['winutil', 'wpd', 'winfonts'])
|
plugins.extend(['winutil', 'wpd', 'winfonts'])
|
||||||
|
19
src/calibre/utils/diff/__init__.py
Normal file
19
src/calibre/utils/diff/__init__.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# vim:fileencoding=utf-8
|
||||||
|
from __future__ import (unicode_literals, division, absolute_import,
|
||||||
|
print_function)
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
|
from calibre.constants import plugins
|
||||||
|
|
||||||
|
def load_patience_module():
|
||||||
|
p, err = plugins['_patiencediff_c']
|
||||||
|
if err is not None:
|
||||||
|
raise ImportError('Failed to import the PatienceDiff C module with error: %s' % err)
|
||||||
|
return p
|
||||||
|
|
||||||
|
def get_sequence_matcher():
|
||||||
|
return load_patience_module().PatienceSequenceMatcher_c
|
||||||
|
|
@ -23,11 +23,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <Python.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <Python.h>
|
|
||||||
|
|
||||||
#include "python-compat.h"
|
/* #include "python-compat.h" Commented out by Kovid as nothing defined in it is needed for this module */
|
||||||
|
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user