--- liblouis-1.6.2.0.orig/configure +++ liblouis-1.6.2.0/configure @@ -9904,27 +9904,6 @@ # before this can be enabled. hardcode_into_libs=yes - # find out which ABI we are using - libsuff= - case "$host_cpu" in - x86_64*|s390x*|powerpc64*) - echo '#line 9911 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *64-bit*) - libsuff=64 - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - ;; - esac - fi - rm -rf conftest* - ;; - esac - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` @@ -13884,27 +13863,6 @@ # before this can be enabled. hardcode_into_libs=yes - # find out which ABI we are using - libsuff= - case "$host_cpu" in - x86_64*|s390x*|powerpc64*) - echo '#line 13891 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *64-bit*) - libsuff=64 - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - ;; - esac - fi - rm -rf conftest* - ;; - esac - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` @@ -16495,27 +16453,6 @@ # before this can be enabled. hardcode_into_libs=yes - # find out which ABI we are using - libsuff= - case "$host_cpu" in - x86_64*|s390x*|powerpc64*) - echo '#line 16502 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *64-bit*) - libsuff=64 - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - ;; - esac - fi - rm -rf conftest* - ;; - esac - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` @@ -19114,27 +19051,6 @@ # before this can be enabled. hardcode_into_libs=yes - # find out which ABI we are using - libsuff= - case "$host_cpu" in - x86_64*|s390x*|powerpc64*) - echo '#line 19121 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *64-bit*) - libsuff=64 - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - ;; - esac - fi - rm -rf conftest* - ;; - esac - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` --- liblouis-1.6.2.0.orig/debian/lou_debug.1 +++ liblouis-1.6.2.0/debian/lou_debug.1 @@ -0,0 +1,8 @@ +.TH LOU_DEBUG "1" "March 2009" "Louis Table Debugger" "User Commands" +.SH NAME +lou_debug \- debug a braille translation table +.SH SYNOPSIS +\fBlou_debug\fR \fItablename\fR +.SH DESCRIPTION +.B lou_debug +is intended for debugging liblouis translation tables. --- liblouis-1.6.2.0.orig/debian/control +++ liblouis-1.6.2.0/debian/control @@ -0,0 +1,75 @@ +Source: liblouis +Priority: extra +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian Accessibility Team +Uploaders: Samuel Thibault , Cyril Brulebois +Build-Depends: debhelper (>= 7), autotools-dev, pkg-config, python-all-dev (>= 2.5), python-support (>= 0.90), texinfo +Standards-Version: 3.8.2 +Section: libs +Vcs-Git: git://git.debian.org/git/pkg-a11y/liblouis +Vcs-Browser: http://git.debian.org/?p=pkg-a11y/liblouis.git +Homepage: http://code.google.com/p/liblouis/ + +Package: liblouis-dev +Section: libdevel +Architecture: any +Depends: liblouis0 (= ${binary:Version}) +Description: Braille translation library - static libs and headers + Liblouis is a braille translator and back-translator. It features support for + computer and literary braille, supports contracted and uncontracted translation + for many languages and has support for hyphenation. Liblouis also supports + math braille (Nemeth and Marburg). + . + This package contains static libraries and development headers. + +Package: liblouis0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, liblouis-data +Description: Braille translation library - shared libs + Liblouis is a braille translator and back-translator. It features support for + computer and literary braille, supports contracted and uncontracted translation + for many languages and has support for hyphenation. Liblouis also supports + math braille (Nemeth and Marburg). + . + This package contains shared libraries. + +Package: liblouis-data +Section: text +Architecture: all +Description: Braille translation library - data + Liblouis is a braille translator and back-translator. It features support for + computer and literary braille, supports contracted and uncontracted translation + for many languages and has support for hyphenation. Liblouis also supports + math braille (Nemeth and Marburg). New languages can easily be added through + tables that support a rule- or dictionary based approach. Included are also + tools for testing and debugging tables. + . + This package contains runtime data. + +Package: liblouis-bin +Section: text +Architecture: any +Depends: ${shlibs:Depends} +Description: Braille translation library - utilities + Liblouis is a braille translator and back-translator. It features support for + computer and literary braille, supports contracted and uncontracted translation + for many languages and has support for hyphenation. Liblouis also supports + math braille (Nemeth and Marburg). New languages can easily be added through + tables that support a rule- or dictionary based approach. Included are also + tools for testing and debugging tables. + . + This package contains a few tools to test tables and translate text. + +Package: python-louis +Section: python +Architecture: any +Depends: ${python:Depends}, liblouis0 (>= ${binary:Version}) +Provides: ${python:Provides} +Description: Python bindings for liblouis + Liblouis is a braille translator and back-translator. It features support for + computer and literary braille, supports contracted and uncontracted translation + for many languages and has support for hyphenation. Liblouis also supports + math braille (Nemeth and Marburg). + . + This package contains Python bindings. --- liblouis-1.6.2.0.orig/debian/changelog +++ liblouis-1.6.2.0/debian/changelog @@ -0,0 +1,103 @@ +liblouis (1.6.2.0-2ubuntu1) karmic; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/control: + + Drop python2.4-ctypes from Build-Depends + + Version python-all-dev to >= 2.5 + * debian/rules: Ensure that LD_LIBRARY_PATH is not completely overridden + + -- Luke Yelavich Thu, 30 Jul 2009 09:48:25 +1000 + +liblouis (1.6.2.0-2) unstable; urgency=low + + * Add texinfo to Build-Depends, fixing FTBFS with missing makeinfo + command, before it gets reported. :) + * Add myself to Uploaders. + + -- Cyril Brulebois Wed, 29 Jul 2009 06:25:24 +0200 + +liblouis (1.6.2.0-1) unstable; urgency=low + + * New upstream release. + * examples: use lou_translate.c and lou_allround.c as examples + (Closes: #535454). + * Include some python examples in pydoc louis. + + -- Samuel Thibault Wed, 29 Jul 2009 01:40:24 +0200 + +liblouis (1.6.1-3) unstable; urgency=low + + [ Samuel Thibault ] + * control: make python-louis's dependency on liblouis0 versioned in case new + functions are added. + + [ Cyril Brulebois ] + * Get rid of XB-Python-Version, useless with python-support. + * Get rid of debian/*.dirs, dh_install does the right thing. + * Fix watch file: trying to match just the basename of the tarball + fails, it looks like it's needed to consider any possible path in + front of it. + + -- Samuel Thibault Sun, 28 Jun 2009 01:28:52 +0200 + +liblouis (1.6.1-2ubuntu2) karmic; urgency=low + + * Undo the change to doc/liblouis.info (i.e. use the Debian change) to make + liblouis-dev installable again. + * debian/control: + - Drop python2.4-ctypes from Build-Depends + - Version python-all-dev to >= 2.5 + * Update watch file + + -- Michael Bienia Tue, 07 Jul 2009 16:25:56 +0200 + +liblouis (1.6.1-2ubuntu1) karmic; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/rules: Add --install-layout=deb to python distutils install command + - debian/control: Add texinfo as a build dependency + - revert to upstream version of doc/liblouis.info, as dpkg fails to build a + source package, claiming the file is binary + + -- Luke Yelavich Fri, 03 Jul 2009 09:53:50 +1000 + +liblouis (1.6.1-2) unstable; urgency=low + + * Load the precise library file from the python bindings (Closes: #530608). + Thanks Cyril Brulebois for the patch! + * Since the python package is called louis and not liblouis, rename package + python-liblouis into python-louis to meet the Debian Python Policy and fix + ${python:Depends} generation (no reverse dependency exist). Make it + Architecture: any instead of all as different systems may have different + liblouis library file names. + * control: Change my email, remove DM-Upload-Allowed, add Vcs-Git and + Vcs-Browser. + * pycompat: Remove, useless with python-support. + * Bump Standards-Version to 3.8.2 (no change needed). + + -- Samuel Thibault Sat, 27 Jun 2009 21:48:19 +0200 + +liblouis (1.6.1-1ubuntu1) karmic; urgency=low + + * debian/rules: Add --install-layout=deb to python distutils install command + * revert to upstream version of doc/liblouis.info, as dpkg fails to build a + source package, claiming the file is binary + * debian/control: add texinfo as a build dependency + + -- Luke Yelavich Tue, 05 May 2009 12:40:14 +1000 + +liblouis (1.6.1-1) unstable; urgency=low + + * New upstream bugfix release. + * Bump Standards-Version to 3.8.1, no changes needed. + * Set CFLAGS to -O2 unless noopt is given in DEB_BUILD_OPTIONS. + * Build liblouis-data in binary-indep instead of binary-arch. + + -- Samuel Thibault Tue, 21 Apr 2009 00:00:00 +0200 + +liblouis (1.6.0-1) unstable; urgency=low + + * Initial release (Closes: #513632). + + -- Samuel Thibault Sat, 07 Mar 2009 23:03:22 +0100 + --- liblouis-1.6.2.0.orig/debian/info +++ liblouis-1.6.2.0/debian/info @@ -0,0 +1 @@ +doc/liblouis.info --- liblouis-1.6.2.0.orig/debian/lou_allround.1 +++ liblouis-1.6.2.0/debian/lou_allround.1 @@ -0,0 +1,8 @@ +.TH LOU_ALLROUND "1" "March 2009" "Louis Allround" "User Commands" +.SH NAME +lou_allround \- liblouis tester +.SH SYNOPSIS +\fBlou_allround\fR +.SH DESCRIPTION +.B lou_allround +tests every capability of the liblouis library. It is completely interactive. --- liblouis-1.6.2.0.orig/debian/liblouis-bin.manpages +++ liblouis-1.6.2.0/debian/liblouis-bin.manpages @@ -0,0 +1,4 @@ +debian/lou_allround.1 +debian/lou_checktable.1 +debian/lou_debug.1 +debian/lou_translate.1 --- liblouis-1.6.2.0.orig/debian/rules +++ liblouis-1.6.2.0/debian/rules @@ -0,0 +1,108 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) +CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) +else +CROSS= --build $(DEB_BUILD_GNU_TYPE) +endif + +ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) +CFLAGS += -O0 +else +CFLAGS += -O2 +endif + +PYVERS := $(shell pyversions -r) + +config.status: configure + dh_testdir + ./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" --enable-ucs4 + + +build: build-stamp +build-stamp: config.status + dh_testdir + $(MAKE) + ( \ + cd python ; \ + for py in $(PYVERS); do \ + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../liblouis/.libs $$py setup.py build; \ + done \ + ) + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + [ ! -f Makefile ] || $(MAKE) distclean + -( \ + cd python ; \ + for py in $(PYVERS); do \ + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../liblouis/.libs $$py setup.py clean --all; \ + done ; \ + rm louis/__init__.pyc \ + ) + rm -f doc/liblouis.info doc/stamp-vti doc/version.texi + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + ( \ + cd python ; \ + for py in $(PYVERS); do \ + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../liblouis/.libs $$py setup.py install --root=$(CURDIR)/debian/python-louis --install-layout=deb; \ + done \ + ) + + +binary-arch: export DH_OPTIONS=-s +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs ChangeLog + dh_installdocs + dh_installexamples + dh_install + dh_installman + dh_installinfo + dh_pysupport + dh_link + dh_strip + dh_compress + dh_fixperms + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary-indep: export DH_OPTIONS=-i +binary-indep: build install + dh_testdir + dh_testroot + dh_installchangelogs ChangeLog + dh_installdocs + dh_install + dh_compress + dh_fixperms + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +get-orig-source: + uscan --verbose --rename --repack --force-download + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- liblouis-1.6.2.0.orig/debian/docs +++ liblouis-1.6.2.0/debian/docs @@ -0,0 +1,4 @@ +NEWS +README +doc/liblouis.html +doc/liblouis.txt --- liblouis-1.6.2.0.orig/debian/lou_translate.1 +++ liblouis-1.6.2.0/debian/lou_translate.1 @@ -0,0 +1,23 @@ +.TH LOU_TRANSLATE "1" "March 2009" "Louis Translate" "User Commands" +.SH NAME +lou_translate \- translate text into braille +.SH SYNOPSIS +\fBlou_translate\fR -f|-b \fItablename\fR +.SH DESCRIPTION +.B lou_translate +translates whatever is on the standard input unit and prints it on the +standard output unit. It is intended for large-scale testing of the accuracy +of translation and back-translation. +.SH OPTIONS +.PP +The following options are supported: +.TP +\fB-f\fR +forward translation +.TP +\fB-b\fR +backward translation +.SH EXAMPLE +To use it to translate or back-translate a file use a line like +.BR +lou_translate -f en-us-g2.ctb testtrans --- liblouis-1.6.2.0.orig/debian/liblouis0.install +++ liblouis-1.6.2.0/debian/liblouis0.install @@ -0,0 +1 @@ +usr/lib/lib*.so.* --- liblouis-1.6.2.0.orig/debian/watch +++ liblouis-1.6.2.0/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://code.google.com/p/liblouis/ (?:.*/)?liblouis-(.*)\.tar\.gz --- liblouis-1.6.2.0.orig/debian/copyright +++ liblouis-1.6.2.0/debian/copyright @@ -0,0 +1,55 @@ +This package was debianized by Samuel Thibault on +Fri, 30 Jan 2009 22:41:58 +0100. + +It was downloaded from http://code.google.com/p/liblouis/ + +Upstream Author: + + John J. Boyer + + Dave Mielke and other BRLTTY team members + + Leon Ungier of ViewPlus Technologies + + John Gardner of ViewPlus Technologies + + Yuemei Sun of ViewPlus Technologies + + Eitan Isaacson + + Alastair Irving + + Christian Egli + + James Teh + + Michel Such + +Copyright: + + Copyright (C) 1999-2008 by the BRLTTY Team + Copyright (C) 2004-2007 ViewPlus Technologies, Inc. `www.viewplus.com'. + Copyright (C) 2004 Computers to Help People, Inc., www.chpi.org + Copyright (C) 2007,2008 JJB Software, Inc. `www.jjb-software.com'. + +License: + + This package is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU Lesser General +Public License can be found in `/usr/share/common-licenses/LGPL'. + +The Debian packaging is (C) 2009, Samuel Thibault and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. --- liblouis-1.6.2.0.orig/debian/liblouis-bin.install +++ liblouis-1.6.2.0/debian/liblouis-bin.install @@ -0,0 +1 @@ +usr/bin/* --- liblouis-1.6.2.0.orig/debian/lou_checktable.1 +++ liblouis-1.6.2.0/debian/lou_checktable.1 @@ -0,0 +1,10 @@ +.TH LOU_CHECKTABLE "1" "March 2009" "Louis Table Checker" "User Commands" +.SH NAME +lou_checktable \- check a braille translation table +.SH SYNOPSIS +\fBlou_checktable\fR \fItablename\fR +.SH DESCRIPTION +.B lou_checktable +checks a given braille translation table. If the table contains errors, +appropriate messages will be displayed. If there are no errors the message ‘no +errors found.’ will be shown. --- liblouis-1.6.2.0.orig/debian/liblouis-data.install +++ liblouis-1.6.2.0/debian/liblouis-data.install @@ -0,0 +1 @@ +usr/share/liblouis/tables --- liblouis-1.6.2.0.orig/debian/liblouis-dev.install +++ liblouis-1.6.2.0/debian/liblouis-dev.install @@ -0,0 +1,5 @@ +usr/include/* +usr/lib/lib*.a +usr/lib/lib*.so +usr/lib/pkgconfig/* +usr/lib/*.la --- liblouis-1.6.2.0.orig/debian/examples +++ liblouis-1.6.2.0/debian/examples @@ -0,0 +1,2 @@ +tools/lou_translate.c +tools/lou_allround.c --- liblouis-1.6.2.0.orig/debian/compat +++ liblouis-1.6.2.0/debian/compat @@ -0,0 +1 @@ +7 --- liblouis-1.6.2.0.orig/python/louis/__init__.py.in +++ liblouis-1.6.2.0/python/louis/__init__.py.in @@ -0,0 +1,171 @@ +# Liblouis Python ctypes bindings +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., Franklin Street, Fifth Floor, +# Boston MA 02110-1301 USA. + +"""Liblouis Python ctypes bindings +These bindings allow you to use the liblouis braille translator and back-translator library from within Python. +This documentation is only a Python helper. +Please see the liblouis documentation for more information. +@note: Back-translation is not currently supported. +@author: Michael Curran +@author: James Teh +@author: Eitan Isaacson + +>>> import louis + +Show a US grade2 translation of a unicode string with no typeform +information: +>>> louis.translateString(['en-us-g2.ctb'], u'Hello world', None, 0) +u',hello _w' + +Now do a translation using bold for the string: +>>> louis.translateString(['en-us-g2.ctb'], u'Hello world', +[louis.bold]*11, 0) +u',hello __w' + +Now do a translation using cursor position: +>>> louis.translate(['en-us-g2.ctb'], u'Hello world', None, 5, 0) +(u',hello _w', [0, 0, 1, 2, 3, 4, 5, 6, 6], [1, 2, 3, 4, 5, 6, 7, 7, 7, +7, 7], 6) +""" + +from ctypes import * +import struct +import atexit + +try: + try: + # Native win32 + liblouis = windll.liblouis + except NameError: + # Cygwin + liblouis = cdll.liblouis +except OSError: + # Unix + liblouis = cdll.LoadLibrary("###LIBLOUIS_SONAME###") + +atexit.register(liblouis.lou_free) + +liblouis.lou_version.restype = c_char_p + +liblouis.lou_translateString.argtypes = ( + c_char_p, c_wchar_p, POINTER(c_int), c_wchar_p, + POINTER(c_int), POINTER(c_char), POINTER(c_char), c_int) + +liblouis.lou_translate.argtypes = ( + c_char_p, c_wchar_p, POINTER(c_int), c_wchar_p, + POINTER(c_int), POINTER(c_char), POINTER(c_char), + POINTER(c_int), POINTER(c_int), POINTER(c_int), c_int) + +def version(): + """Obtain version information for liblouis. + @return: The version of liblouis, plus other information, such as + the release date and perhaps notable changes. + @rtype: str + """ + return liblouis.lou_version() + +def translate(tran_tables, inbuf, typeform=None,cursorPos=0, mode=0): + """Translate a string of characters, providing position information. + @param tran_tables: A list of translation tables. + The first table in the list must be a full pathname, unless the tables are in the current directory. + @type tran_tables: list of str + @param inbuf: The string to translate. + @type inbuf: unicode + @param typeform: A list of typeform constants indicating the typeform for each position in inbuf, + C{None} for no typeform information. + @type typeform: list of int + @param cursorPos: The position of the cursor in inbuf. + @type cursorPos: int + @param mode: The translation mode; add multiple values for a combined mode. + @type mode: int + @return: A tuple of: the translated string, + a list of input positions for each position in the output, + a list of output positions for each position in the input, and + the position of the cursor in the output. + @rtype: (unicode, list of int, list of int, int) + @raise RuntimeError: If a complete translation could not be done. + @see: lou_translate in the liblouis documentation + """ + tablesString = ",".join([str(x) for x in tran_tables]) + inbuf = unicode(inbuf) + if typeform: + typeform = struct.pack('B'*len(typeform),*typeform) + else: + typeform = None + inlen = c_int(len(inbuf)) + outlen = c_int(inlen.value*2) + outbuf = create_unicode_buffer(outlen.value) + inPos = (c_int*outlen.value)() + outPos = (c_int*inlen.value)() + cursorPos = c_int(cursorPos) + if not liblouis.lou_translate(tablesString, inbuf, byref(inlen), + outbuf, byref(outlen), typeform, + None, outPos, inPos, byref(cursorPos), mode): + raise RuntimeError("can't translate: tables %s, inbuf %s, typeform %s, cursorPos %s, mode %s"%(tran_tables, inbuf, typeform, cursorPos, mode)) + return outbuf.value, inPos[:outlen.value], outPos[:inlen.value], cursorPos.value + +def translateString(tran_tables, inbuf, typeform = None, mode = 0): + """Translate a string of characters. + @param tran_tables: A list of translation tables. + The first table in the list must be a full pathname, unless the tables are in the current directory. + @type tran_tables: list of str + @param inbuf: The string to translate. + @type inbuf: unicode + @param typeform: A list of typeform constants indicating the typeform for each position in inbuf, + C{None} for no typeform information. + @type typeform: list of int + @param mode: The translation mode; add multiple values for a combined mode. + @type mode: int + @return: The translated string. + @rtype: unicode + @raise RuntimeError: If a complete translation could not be done. + @see: lou_translateString in the liblouis documentation + """ + tablesString = ",".join([str(x) for x in tran_tables]) + inbuf = unicode(inbuf) + if typeform: + typeform = struct.pack('B'*len(typeform), *typeform) + else: + typeform = None + inlen = c_int(len(inbuf)) + outlen = c_int(inlen.value*2) + outbuf = create_unicode_buffer(outlen.value) + if not liblouis.lou_translateString(tablesString, inbuf, byref(inlen), + outbuf, byref(outlen), typeform, + None, mode): + raise RuntimeError("can't translate: tables %s, inbuf %s, typeform %s, mode %s"%(tran_tables, inbuf, typeform, mode)) + return outbuf.value + +#{ Typeforms +plain_text = 0 +italic = 1 +underline = 2 +bold = 4 +computer_braille = 8 + +#{ Translation modes +noContractions = 1 +compbrlAtCursor = 2 +dotsIO = 4 +comp8Dots = 8 +pass1Only = 16 +#} + +if __name__ == '__main__': + # Just some common tests. + print version() + print translate(['../tables/en-us-g2.ctb'], u'Hello world!', cursorPos=5) --- liblouis-1.6.2.0.orig/python/louis/Makefile.am +++ liblouis-1.6.2.0/python/louis/Makefile.am @@ -1,2 +1,10 @@ -EXTRA_DIST = __init__.py +EXTRA_DIST = __init__.py.in +CLEANFILES = __init__.py +LIBLOUIS_SONAME = $(shell source ../../liblouis/liblouis.la ; echo $$dlname) + +all: + source ../../liblouis/liblouis.la ; \ + sed "s/###LIBLOUIS_SONAME###/$$dlname/" \ + < $(srcdir)/__init__.py.in \ + > __init__.py --- liblouis-1.6.2.0.orig/python/louis/Makefile.in +++ liblouis-1.6.2.0/python/louis/Makefile.in @@ -154,7 +154,9 @@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -EXTRA_DIST = __init__.py +EXTRA_DIST = __init__.py.in +CLEANFILES = __init__.py +LIBLOUIS_SONAME = $(shell source ../../liblouis/liblouis.la ; echo $$dlname) all: all-am .SUFFIXES: @@ -252,6 +254,7 @@ mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -315,6 +318,12 @@ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-info-am + +all: + source ../../liblouis/liblouis.la ; \ + sed "s/###LIBLOUIS_SONAME###/$$dlname/" \ + < $(srcdir)/__init__.py.in \ + > __init__.py # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: