- Upstream update to 0.5.0

epel9
Ding-Yi Chen 9 years ago
parent 2a2ddc220b
commit f04c780def

1
.gitignore vendored

@ -7,3 +7,4 @@ libchewing-0.3.2.tar.bz2
/libchewing.spec /libchewing.spec
/libchewing-0.3.5.tar.bz2 /libchewing-0.3.5.tar.bz2
/v0.4.0.tar.gz /v0.4.0.tar.gz
/v0.5.0.tar.gz

@ -1,33 +1,55 @@
from ctypes import * from ctypes import *
from functools import partial from functools import partial
import sys
_libchewing = None
if sys.platform == "win32": # Windows
import os.path
# find in current dir first
dll_path = os.path.join(os.path.dirname(__file__), "chewing.dll")
if not os.path.exists(dll_path):
dll_path = "chewing.dll" # search in system path
_libchewing = CDLL(dll_path)
else: # UNIX-like systems
_libchewing = CDLL('libchewing.so.3')
_libchewing = CDLL('libchewing.so.3')
_libchewing.chewing_commit_String.restype = c_char_p _libchewing.chewing_commit_String.restype = c_char_p
_libchewing.chewing_buffer_String.restype = c_char_p _libchewing.chewing_buffer_String.restype = c_char_p
_libchewing.chewing_cand_String.restype = c_char_p _libchewing.chewing_cand_String.restype = c_char_p
_libchewing.chewing_zuin_String.restype = c_char_p _libchewing.chewing_zuin_String.restype = c_char_p
_libchewing.chewing_aux_String.restype = c_char_p _libchewing.chewing_aux_String.restype = c_char_p
_libchewing.chewing_get_KBString.restype = c_char_p
def Init(datadir, userdir): def Init(datadir, userdir):
return _libchewing.chewing_Init(datadir, userdir) return _libchewing.chewing_Init(datadir, userdir)
class ChewingContext: class ChewingContext:
def __init__(self): def __init__(self, **kwargs):
self.ctx = _libchewing.chewing_new() if not kwargs:
self.ctx = _libchewing.chewing_new()
else:
syspath = kwargs.get("syspath", None)
userpath = kwargs.get("userpath", None)
self.ctx = _libchewing.chewing_new2(
syspath,
userpath,
None,
None)
def __del__(self): def __del__(self):
_libchewing.chewing_free(self.ctx) _libchewing.chewing_delete(self.ctx)
def __getattr__(self, name): def __getattr__(self, name):
func = 'chewing_' + name func = 'chewing_' + name
if func in _libchewing.__dict__: if hasattr(_libchewing, func):
wrap = partial(_libchewing.__dict__[func], self.ctx) wrap = partial(getattr(_libchewing, func), self.ctx)
setattr(self, name, wrap)
return wrap
elif hasattr(_libchewing, func):
wrap = partial(_libchewing.__getattr__(func), self.ctx)
setattr(self, name, wrap) setattr(self, name, wrap)
return wrap return wrap
else: else:
raise AttributeError, name raise AttributeError(name)
def Configure(self, cpp, maxlen, direction, space, kbtype): def Configure(self, cpp, maxlen, direction, space, kbtype):
self.set_candPerPage(cpp) self.set_candPerPage(cpp)
self.set_maxChiSymbolLen(maxlen) self.set_maxChiSymbolLen(maxlen)

@ -5,8 +5,8 @@
%global name_zh_TW %{im_name_zh_TW}函式庫 %global name_zh_TW %{im_name_zh_TW}函式庫
Name: libchewing Name: libchewing
Version: 0.4.0 Version: 0.5.0
Release: 6%{?dist} Release: 1%{?dist}
Summary: Intelligent phonetic input method library for Traditional Chinese Summary: Intelligent phonetic input method library for Traditional Chinese
Summary(zh_TW): %{name_zh_TW} Summary(zh_TW): %{name_zh_TW}
@ -116,6 +116,9 @@ fi
%{libchewing_python_dir} %{libchewing_python_dir}
%changelog %changelog
* Sat May 07 2016 Ding-Yi Chen <dchen@redhat.com> - 0.5.0-1
- Upstream update to 0.5.0
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-6 * Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

@ -1 +1 @@
2537d7c7b890973c594bac6c598f20bc v0.4.0.tar.gz 553b1c85a037958af9c872790add16f3 v0.5.0.tar.gz

Loading…
Cancel
Save