[Debian-hebrew-package] [svn] r329 -
pkg/pyfribidi/branches/upstream/current
Baruch Even
baruch at costa.debian.org
Sun Jan 15 23:01:25 UTC 2006
Author: baruch
Date: Sun Jan 15 23:01:24 2006
New Revision: 329
Added:
pkg/pyfribidi/branches/upstream/current/fribidi_systray.py
pkg/pyfribidi/branches/upstream/current/syspath.py
pkg/pyfribidi/branches/upstream/current/time_pyfribidi.py
Modified:
pkg/pyfribidi/branches/upstream/current/ChangeLog
pkg/pyfribidi/branches/upstream/current/INSTALL
pkg/pyfribidi/branches/upstream/current/Makefile.am
pkg/pyfribidi/branches/upstream/current/Makefile.in
pkg/pyfribidi/branches/upstream/current/aclocal.m4
pkg/pyfribidi/branches/upstream/current/configure
pkg/pyfribidi/branches/upstream/current/configure.in
pkg/pyfribidi/branches/upstream/current/pyfribidi.c
pkg/pyfribidi/branches/upstream/current/setup.py
pkg/pyfribidi/branches/upstream/current/test_pyfribidi.py
Log:
Load /tmp/tmp.DYoHMe/pyfribidi-0.3.8 into
pkg/pyfribidi/branches/upstream/current.
Modified: pkg/pyfribidi/branches/upstream/current/ChangeLog
==============================================================================
--- pkg/pyfribidi/branches/upstream/current/ChangeLog (original)
+++ pkg/pyfribidi/branches/upstream/current/ChangeLog Sun Jan 15 23:01:24 2006
@@ -1,3 +1,19 @@
+pyfribidi 0.3.6
+
+ * Nir Soffer: Raise ValueError for invalid base_dir_string.
+ * Nir Soffer: Added detailed docstring
+ * Nir Soffer: Use real unittests, add some tests.
+
+ -- kobi <kzamir at walla.co.il> Thu, 12 Jan 2006 00:59:24 +0200
+
+pyfribidi 0.3.5
+
+ * Nir Soffer: add suggestion to use setup.py in the INSTALL file.
+ * add fribidi-systray.py example, this example use GTK and creates a system tray
+ icon that convert the content of the clipboard.
+
+ -- kobi <kzamir at walla.co.il> Thu, 12 Jan 2006 00:59:24 +0200
+
pyfribidi 0.3.2
* fix configure script to check for python devel files
Modified: pkg/pyfribidi/branches/upstream/current/INSTALL
==============================================================================
--- pkg/pyfribidi/branches/upstream/current/INSTALL (original)
+++ pkg/pyfribidi/branches/upstream/current/INSTALL Sun Jan 15 23:01:24 2006
@@ -1,3 +1,13 @@
+Quick installation
+==================
+
+ 1. `cd' to the directory containing the package's source code.
+
+ 2. Type `python setup.py install' to install the programs and any data
+ files and documentation.
+
+If it does not work for you, please read on.
+
Basic Installation
==================
Modified: pkg/pyfribidi/branches/upstream/current/Makefile.am
==============================================================================
--- pkg/pyfribidi/branches/upstream/current/Makefile.am (original)
+++ pkg/pyfribidi/branches/upstream/current/Makefile.am Sun Jan 15 23:01:24 2006
@@ -1,4 +1,6 @@
-EXTRA_DIST = pyfribidi.c fribidi-test.py autogen.sh setup.py NEWS README AUTHORS ChangeLog
+EXTRA_DIST = pyfribidi.c test_pyfribidi.py time_pyfribidi.py \
+ fribidi_systray.py syspath.py \
+ autogen.sh setup.py NEWS README AUTHORS ChangeLog
all-am: pyfribidi.so
Modified: pkg/pyfribidi/branches/upstream/current/Makefile.in
==============================================================================
--- pkg/pyfribidi/branches/upstream/current/Makefile.in (original)
+++ pkg/pyfribidi/branches/upstream/current/Makefile.in Sun Jan 15 23:01:24 2006
@@ -71,7 +71,8 @@
VERSION = @VERSION@
have_python = @have_python@
-EXTRA_DIST = pyfribidi.c fribidi-test.py autogen.sh setup.py NEWS README AUTHORS ChangeLog
+EXTRA_DIST = pyfribidi.c test_pyfribidi.py time_pyfribidi.py fribidi_systray.py syspath.py autogen.sh setup.py NEWS README AUTHORS ChangeLog
+
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
Modified: pkg/pyfribidi/branches/upstream/current/aclocal.m4
==============================================================================
--- pkg/pyfribidi/branches/upstream/current/aclocal.m4 (original)
+++ pkg/pyfribidi/branches/upstream/current/aclocal.m4 Sun Jan 15 23:01:24 2006
@@ -1009,7 +1009,7 @@
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
- _pkg_min_version=m4_ifval([$1], [$1], [0.9.0])
+ _pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
@@ -1045,14 +1045,30 @@
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$PKG_CONFIG"; then
+ if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ else
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
[pkg_failed=yes])
+ fi
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND])
#
@@ -1074,19 +1090,30 @@
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
if test $pkg_failed = yes; then
- $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+ fi
# Put the nasty error message in config.log where it belongs
- echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
ifelse([$4], , [AC_MSG_ERROR(dnl
-[Package requirements ($2) were not met.
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
-Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
-to avoid the need to call pkg-config. See the pkg-config man page for
-more details.])],
+_PKG_TEXT
+])],
[$4])
elif test $pkg_failed = untried; then
ifelse([$4], , [AC_MSG_FAILURE(dnl
@@ -1094,9 +1121,7 @@
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
-Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
-to avoid the need to call pkg-config. See the pkg-config man page for
-more details.
+_PKG_TEXT
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
[$4])
Modified: pkg/pyfribidi/branches/upstream/current/configure
==============================================================================
--- pkg/pyfribidi/branches/upstream/current/configure (original)
+++ pkg/pyfribidi/branches/upstream/current/configure Sun Jan 15 23:01:24 2006
@@ -1460,7 +1460,7 @@
PACKAGE=pyfribidi
-VERSION=0.3.4
+VERSION=0.3.8
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
{ { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
@@ -3615,6 +3615,9 @@
echo $ECHO_N "checking for fribidi... $ECHO_C" >&6
if test -n "$PKG_CONFIG"; then
+ if test -n "$fribidi_CFLAGS"; then
+ pkg_cv_fribidi_CFLAGS="$fribidi_CFLAGS"
+ else
if test -n "$PKG_CONFIG" && \
{ (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"fribidi\"") >&5
($PKG_CONFIG --exists --print-errors "fribidi") 2>&5
@@ -3625,10 +3628,14 @@
else
pkg_failed=yes
fi
+ fi
else
pkg_failed=untried
fi
if test -n "$PKG_CONFIG"; then
+ if test -n "$fribidi_LIBS"; then
+ pkg_cv_fribidi_LIBS="$fribidi_LIBS"
+ else
if test -n "$PKG_CONFIG" && \
{ (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"fribidi\"") >&5
($PKG_CONFIG --exists --print-errors "fribidi") 2>&5
@@ -3639,38 +3646,59 @@
else
pkg_failed=yes
fi
+ fi
else
pkg_failed=untried
fi
+
+
if test $pkg_failed = yes; then
- fribidi_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fribidi"`
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ fribidi_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "fribidi"`
+ else
+ fribidi_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fribidi"`
+ fi
# Put the nasty error message in config.log where it belongs
- echo "$fribidi_PKG_ERRORS" 1>&5
+ echo "$fribidi_PKG_ERRORS" >&5
+
+ { { echo "$as_me:$LINENO: error: Package requirements (fribidi) were not met:
+
+$fribidi_PKG_ERRORS
- { { echo "$as_me:$LINENO: error: Package requirements (fribidi) were not met.
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
-Alternatively you may set the fribidi_CFLAGS and fribidi_LIBS environment variables
-to avoid the need to call pkg-config. See the pkg-config man page for
-more details." >&5
-echo "$as_me: error: Package requirements (fribidi) were not met.
+Alternatively, you may set the environment variables fribidi_CFLAGS
+and fribidi_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" >&5
+echo "$as_me: error: Package requirements (fribidi) were not met:
+
+$fribidi_PKG_ERRORS
+
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
-Alternatively you may set the fribidi_CFLAGS and fribidi_LIBS environment variables
-to avoid the need to call pkg-config. See the pkg-config man page for
-more details." >&2;}
+Alternatively, you may set the environment variables fribidi_CFLAGS
+and fribidi_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" >&2;}
{ (exit 1); exit 1; }; }
elif test $pkg_failed = untried; then
{ { echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
-Alternatively you may set the fribidi_CFLAGS and fribidi_LIBS environment variables
-to avoid the need to call pkg-config. See the pkg-config man page for
-more details.
+Alternatively, you may set the environment variables fribidi_CFLAGS
+and fribidi_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
See \`config.log' for more details." >&5
@@ -3678,9 +3706,9 @@
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
-Alternatively you may set the fribidi_CFLAGS and fribidi_LIBS environment variables
-to avoid the need to call pkg-config. See the pkg-config man page for
-more details.
+Alternatively, you may set the environment variables fribidi_CFLAGS
+and fribidi_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
See \`config.log' for more details." >&2;}
Modified: pkg/pyfribidi/branches/upstream/current/configure.in
==============================================================================
--- pkg/pyfribidi/branches/upstream/current/configure.in (original)
+++ pkg/pyfribidi/branches/upstream/current/configure.in Sun Jan 15 23:01:24 2006
@@ -1,6 +1,6 @@
AC_INIT(pyfribidi.c)
-AM_INIT_AUTOMAKE(pyfribidi, 0.3.4)
+AM_INIT_AUTOMAKE(pyfribidi, 0.3.8)
AC_ISC_POSIX
AC_PROG_CC
Modified: pkg/pyfribidi/branches/upstream/current/pyfribidi.c
==============================================================================
--- pkg/pyfribidi/branches/upstream/current/pyfribidi.c (original)
+++ pkg/pyfribidi/branches/upstream/current/pyfribidi.c Sun Jan 15 23:01:24 2006
@@ -1,3 +1,4 @@
+
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -13,8 +14,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
-/* Copyright (C) 2005 Yaacov Zamir */
+
+/* Copyright (C) 2005,2006 Yaacov Zamir, Nir Soffer */
/* FriBidi python binding:
@@ -26,72 +27,91 @@
mv pyfribidi.so /usr/lib/python2.3/site-packages/
*/
-
+
#include <fribidi.h>
#undef _POSIX_C_SOURCE
#include <Python.h>
#define MAX_STR_LEN 65000
-int simple_log2vis (char *instring, char *outstring, FriBidiCharType base);
+int simple_log2vis (char *instring, FriBidiCharType base, char *outstring);
static PyObject *_pyfribidi_log2vis (PyObject * self, PyObject * args);
void initpyfribidi (void);
int
-simple_log2vis (char *instring, char *outstring, FriBidiCharType base)
+simple_log2vis (char *instring, FriBidiCharType base, char *outstring)
{
- /* the fribidi unicode strings */
- FriBidiChar logical[MAX_STR_LEN];
- FriBidiChar visual[MAX_STR_LEN];
-
- /* fribidi unicode string length */
- FriBidiStrIndex len;
-
- /* do vis2log */
- len = strlen (instring);
- len = fribidi_utf8_to_unicode (instring, len, logical);
- fribidi_log2vis (logical, len, &base, visual, NULL, NULL, NULL);
- fribidi_unicode_to_utf8 (visual, len, outstring);
-
- return 0;
+ /* the fribidi unicode strings */
+ FriBidiChar logical[MAX_STR_LEN];
+ FriBidiChar visual[MAX_STR_LEN];
+
+ /* fribidi unicode string length */
+ FriBidiStrIndex len = strlen (instring);
+
+ if (len < MAX_STR_LEN)
+ {
+ len = fribidi_utf8_to_unicode (instring, len, logical);
+ fribidi_log2vis (logical, len, &base, visual, NULL, NULL, NULL);
+ fribidi_unicode_to_utf8 (visual, len, outstring);
+ }
+ else
+ {
+ outstring[0] = '\0';
+ }
+ return 0;
}
+/* From fribidi-0.10.7 README */
+PyDoc_STRVAR (_pyfribidi_log2vis__doc__,
+ "log2vis(logical_string, base_direction='RTL') -> visual_string\n\n"
+ "Reorder logical string to visual order using base direction.\n\n"
+ "- logical_string: string using utf-8 encoding\n"
+ "- base_direction: optional input and output base direction. Either\n"
+ " 'LTR', 'RTL' or 'ON'. 'ON' will cause fribidi to calculate the\n"
+ " base direction according to the BiDi algorithm.\n"
+ "- returns: string in visual order using utf-8 encoding\n");
+
static PyObject *
_pyfribidi_log2vis (PyObject * self, PyObject * args)
{
- char *instring = NULL;
- char *base_dir_string = NULL;
- char outstring[MAX_STR_LEN] = "";
-
- if (!PyArg_ParseTuple (args, "s|s", &instring, &base_dir_string))
- return NULL;
+ char *instring = NULL;
+ const char *base_dir_string = "RTL"; /* Default */
+ FriBidiCharType base_dir;
+ char outstring[MAX_STR_LEN] = "";
+
+ if (!PyArg_ParseTuple (args, "s|s", &instring, &base_dir_string))
+ return NULL;
+
+ /* Map base_dir_string to FriBidiCharType value */
+ if ((strcmp (base_dir_string, "RTL")) == 0)
+ base_dir = FRIBIDI_TYPE_RLE;
+ else if ((strcmp (base_dir_string, "LTR")) == 0)
+ base_dir = FRIBIDI_TYPE_LTR;
+ else if ((strcmp (base_dir_string, "ON")) == 0)
+ base_dir = FRIBIDI_TYPE_ON;
+ else
+ {
+ PyErr_Format (PyExc_ValueError,
+ "invalid value '%s': exepcted 'RTL', 'LTR' or 'ON'",
+ base_dir_string);
+ return NULL;
+ }
- /* check for base dir */
- if (base_dir_string == NULL)
- simple_log2vis (instring, outstring, FRIBIDI_TYPE_RLE);
- else if (strcmp (base_dir_string, "RTL") == 0)
- simple_log2vis (instring, outstring, FRIBIDI_TYPE_RLE);
- else if (strcmp (base_dir_string, "LTR") == 0)
- simple_log2vis (instring, outstring, FRIBIDI_TYPE_LTR);
- else if (strcmp (base_dir_string, "ON") == 0)
- simple_log2vis (instring, outstring, FRIBIDI_TYPE_ON);
- /* default is right to left */
- else
- simple_log2vis (instring, outstring, FRIBIDI_TYPE_RLE);
-
- return Py_BuildValue ("s", outstring);
+ simple_log2vis (instring, base_dir, outstring);
+
+ return Py_BuildValue ("s", outstring);
}
static PyMethodDef PyfribidiMethods[] = {
- {"log2vis", (PyCFunction) _pyfribidi_log2vis, METH_VARARGS,
- "fribidi log2vis binding to python"},
- {NULL, NULL, 0, NULL}
+ {"log2vis", (PyCFunction) _pyfribidi_log2vis, METH_VARARGS,
+ _pyfribidi_log2vis__doc__},
+ {NULL, NULL, 0, NULL}
};
void
initpyfribidi (void)
{
- (void) Py_InitModule ("pyfribidi", PyfribidiMethods);
+ (void) Py_InitModule ("pyfribidi", PyfribidiMethods);
}
Modified: pkg/pyfribidi/branches/upstream/current/setup.py
==============================================================================
--- pkg/pyfribidi/branches/upstream/current/setup.py (original)
+++ pkg/pyfribidi/branches/upstream/current/setup.py Sun Jan 15 23:01:24 2006
@@ -21,7 +21,7 @@
return l
setup (name = "pyfribidi",
- version = "0.3.4",
+ version = "0.3.8",
description = "Python libfribidi interface",
author = "Yaacov Zamir",
author_email = "kzamir at walla.co.il",
Modified: pkg/pyfribidi/branches/upstream/current/test_pyfribidi.py
==============================================================================
--- pkg/pyfribidi/branches/upstream/current/test_pyfribidi.py (original)
+++ pkg/pyfribidi/branches/upstream/current/test_pyfribidi.py Sun Jan 15 23:01:24 2006
@@ -1,16 +1,49 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
+"""
+These are very basic tests, beacue fribidi has its own tests. It may be
+better to reuse fribidi own tests, but its not clear what is the value
+of base_dir for those tests.
+"""
+# uncomment import syspath on Mac OS X to test uninstalled version
+#import syspath
+import unittest
import pyfribidi
-print "שלום"
-print pyfribidi.log2vis ("שלום")
-print "hello - שלום"
-print pyfribidi.log2vis ("hello - שלום", "RTL")
+class BasicTests(unittest.TestCase):
-print "hello - שלום"
-print pyfribidi.log2vis ("hello - שלום", "LTR")
+ def testDefaultDirection(self):
+ """ use RTL default """
+ self.assertEqual(pyfribidi.log2vis("hello - שלום"),
+ pyfribidi.log2vis("hello - שלום", 'RTL'))
-print "hello - שלום"
-print pyfribidi.log2vis ("hello - שלום", "ON")
+ def testAsRTL(self):
+ """ reorder line as RTL """
+ self.assertEqual(pyfribidi.log2vis("hello - שלום", 'RTL'),
+ "םולש - hello")
+
+ def testAsLTR(self):
+ """ reorder line as LTR """
+ self.assertEqual(pyfribidi.log2vis("hello - שלום", 'LTR'),
+ "hello - םולש")
+
+ def testNaturalLTR(self):
+ """ reorder LTR line by natural order """
+ self.assertEqual(pyfribidi.log2vis("hello - שלום", 'ON'),
+ "hello - םולש")
+
+ def testNaturalRTL(self):
+ """ reorder RTL line by natural order """
+ self.assertEqual(pyfribidi.log2vis("שלום - hello", 'ON'),
+ "hello - םולש")
+
+ def testInvalidDirection(self):
+ """ raise ValueError for invalid direction """
+ self.assertRaises(ValueError, pyfribidi.log2vis, "שלום", 'foo')
+
+
+if __name__ == '__main__':
+ suite = unittest.defaultTestLoader.loadTestsFromName(__name__)
+ unittest.TextTestRunner(verbosity=2).run(suite)
More information about the Debian-hebrew-package
mailing list