mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Do not compile span_contractions on OS X as span_set is not available in the system icu library
This commit is contained in:
parent
f860264d31
commit
315722a2bd
@ -273,6 +273,8 @@ icu_Collator_contractions(icu_Collator *self, PyObject *args, PyObject *kwargs)
|
||||
} // }}}
|
||||
|
||||
// Collator.span_contractions {{{
|
||||
#ifndef __APPLE__
|
||||
// uset_span is not available in the version of ICU on Apple's idiotic OS
|
||||
static PyObject *
|
||||
icu_Collator_span_contractions(icu_Collator *self, PyObject *args, PyObject *kwargs) {
|
||||
int span_type;
|
||||
@ -302,8 +304,9 @@ icu_Collator_span_contractions(icu_Collator *self, PyObject *args, PyObject *kwa
|
||||
ret = uset_span(self->contractions, s, slen, span_type);
|
||||
free(s); free(buf);
|
||||
return Py_BuildValue("i", ret);
|
||||
} // }}}
|
||||
|
||||
}
|
||||
#endif
|
||||
// }}}
|
||||
|
||||
static PyObject*
|
||||
icu_Collator_clone(icu_Collator *self, PyObject *args, PyObject *kwargs);
|
||||
@ -325,9 +328,11 @@ static PyMethodDef icu_Collator_methods[] = {
|
||||
"contractions() -> returns the contractions defined for this collator."
|
||||
},
|
||||
|
||||
#ifndef __APPLE__
|
||||
{"span_contractions", (PyCFunction)icu_Collator_span_contractions, METH_VARARGS,
|
||||
"span_contractions(src, span_condition) -> returns the length of the initial substring according to span_condition in the set of contractions for this collator. Returns 0 if src does not fit the span_condition. The span_condition can be one of USET_SPAN_NOT_CONTAINED, USET_SPAN_CONTAINED, USET_SPAN_SIMPLE."
|
||||
},
|
||||
#endif
|
||||
|
||||
{"clone", (PyCFunction)icu_Collator_clone, METH_VARARGS,
|
||||
"clone() -> returns a clone of this collator."
|
||||
@ -609,7 +614,10 @@ initicu(void)
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
u_init(&status);
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
if (PyType_Ready(&icu_CollatorType) < 0)
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ def load_icu():
|
||||
if _icu is None:
|
||||
_icu = plugins['icu'][0]
|
||||
if _icu is None:
|
||||
print plugins['icu'][1]
|
||||
print 'Loading ICU failed with: ', plugins['icu'][1]
|
||||
else:
|
||||
if not getattr(_icu, 'ok', False):
|
||||
print 'icu not ok'
|
||||
|
Loading…
x
Reference in New Issue
Block a user