Fix Python loading of errno
authorYaakov Selkowitz <yselkowitz@users.sourceforge.net>
Mon, 27 Aug 2012 03:56:33 +0000 (22:56 -0500)
committerYaakov Selkowitz <yselkowitz@users.sourceforge.net>
Mon, 27 Aug 2012 03:56:33 +0000 (22:56 -0500)
0.99.18-python-errno.patch [new file with mode: 0644]
libcaca-0.99.beta18-1.cygport

diff --git a/0.99.18-python-errno.patch b/0.99.18-python-errno.patch
new file mode 100644 (file)
index 0000000..f8c9301
--- /dev/null
@@ -0,0 +1,248 @@
+--- origsrc/libcaca-0.99.beta18/python/caca/__init__.py        2012-04-06 13:46:08.000000000 -0500
++++ src/libcaca-0.99.beta18/python/caca/__init__.py    2012-08-26 22:34:31.236536600 -0500
+@@ -25,6 +25,7 @@ if find_library('caca') is not None:
+ else:
+     raise ImportError(
+         "Can't find shared library, you need to install libcaca in your path !")
++_libc = ctypes.cdll.LoadLibrary(find_library('c'))
+ #functions to handle string/bytes in python3+
+ if sys.version_info[0:2] >= (3, 0):
+--- origsrc/libcaca-0.99.beta18/python/caca/canvas.py  2012-04-06 13:46:08.000000000 -0500
++++ src/libcaca-0.99.beta18/python/caca/canvas.py      2012-08-26 22:41:39.773047500 -0500
+@@ -17,7 +17,7 @@
+ import ctypes
+ import errno
+-from caca import _lib, utf8_to_utf32, utf32_to_utf8
++from caca import _lib, _libc, utf8_to_utf32, utf32_to_utf8
+ from caca import _PYTHON3, _str_to_bytes, _bytes_to_str
+ from caca.font import _Font
+@@ -70,7 +70,7 @@ class Canvas(_Canvas):
+                 raise CanvasError("Specified width or height is invalid")
+             else:
+                 if self._cv == 0:
+-                    err = ctypes.c_int.in_dll(_lib, "errno")
++                    err = ctypes.c_int.in_dll(_libc, "__errno")
+                     if err.value == errno.EINVAL:
+                         raise CanvasError("Specified width or height is"
+                                           " invalid")
+@@ -110,7 +110,7 @@ class Canvas(_Canvas):
+             raise CanvasError("Specified width or height is invalid")
+         else:
+             if ret == -1:
+-                err = ctypes.c_int.in_dll(_lib, "errno")
++                err = ctypes.c_int.in_dll(_libc, "__errno")
+                 if err.value == errno.EINVAL:
+                     raise CanvasError("Specified width or height is invalid")
+                 elif err.value == errno.EBUSY:
+@@ -363,7 +363,7 @@ class Canvas(_Canvas):
+             raise CanvasError("Specified coordinate X or Y is invalid")
+         else:
+             if ret == -1:
+-                err = ctypes.c_int.in_dll(_lib, "errno")
++                err = ctypes.c_int.in_dll(_libc, "__errno")
+                 if err.value == errno.EINVAL:
+                     raise CanvasError("A mask was specified but the mask size"
+                                       " and source canvas size do not match")
+@@ -389,7 +389,7 @@ class Canvas(_Canvas):
+             raise CanvasError("Specified coordinate or size is invalid")
+         else:
+             if ret == -1:
+-                err = ctypes.c_int.in_dll(_lib, "errno")
++                err = ctypes.c_int.in_dll(_libc, "__errno")
+                 if err.value == errno.EINVAL:
+                     raise CanvasError("Specified width or height is invalid")
+                 elif err.value == errno.EBUSY:
+@@ -417,7 +417,7 @@ class Canvas(_Canvas):
+         ret = _lib.caca_enable_dirty_rect(self)
+         if ret == -1:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if err.value == errno.EINVAL:
+                 raise CanvasError("Dirty rectangles were not disabled")
+         else:
+@@ -456,7 +456,7 @@ class Canvas(_Canvas):
+             raise CanvasError("Specified rectangle index is invalid")
+         else:
+             if ret == -1:
+-                err = ctypes.c_int.in_dll(_lib, "errno")
++                err = ctypes.c_int.in_dll(_libc, "__errno")
+                 if err.value == errno.EINVAL:
+                     raise CanvasError("Specified rectangle index is out of"
+                                       " bounds")
+@@ -487,7 +487,7 @@ class Canvas(_Canvas):
+             raise CanvasError("Specified coordinate or size is invalid")
+         else:
+             if ret == -1:
+-                err = ctypes.c_int.in_dll(_lib, "errno")
++                err = ctypes.c_int.in_dll(_libc, "__errno")
+                 if err.value == errno.EINVAL:
+                     raise CanvasError("Specified rectangle coordinates are out"
+                                       " of bounds")
+@@ -514,7 +514,7 @@ class Canvas(_Canvas):
+             raise CanvasError("Specified coordinate or size is invalid")
+         else:
+             if ret == -1:
+-                err = ctypes.c_int.in_dll(_lib, "errno")
++                err = ctypes.c_int.in_dll(_libc, "__errno")
+                 if err.value == errno.EINVAL:
+                     raise CanvasError("Specified rectangle coordinates are out"
+                                       " of bounds")
+@@ -569,7 +569,7 @@ class Canvas(_Canvas):
+         ret = _lib.caca_rotate_left(self)
+         if ret == -1:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if err.value == errno.EBUSY:
+                 raise CanvasError("The canvas is in use by a display driver"
+                                   " and cannot be rotated")
+@@ -587,7 +587,7 @@ class Canvas(_Canvas):
+         ret = _lib.caca_rotate_right(self)
+         if ret == -1:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if err.value == errno.EBUSY:
+                 raise CanvasError("The canvas is in use by a display driver"
+                                   " and cannot be rotated")
+@@ -605,7 +605,7 @@ class Canvas(_Canvas):
+         ret = _lib.caca_stretch_left(self)
+         if ret == -1:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if err.value == errno.EBUSY:
+                 raise CanvasError("The canvas is in use by a display driver"
+                                   " and cannot be rotated")
+@@ -623,7 +623,7 @@ class Canvas(_Canvas):
+         ret = _lib.caca_stretch_right(self)
+         if ret == -1:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if err.value == errno.EBUSY:
+                 raise CanvasError("The canvas is in use by a display driver"
+                                   " and cannot be rotated")
+@@ -730,7 +730,7 @@ class Canvas(_Canvas):
+             raise CanvasError("At least one of the colour values is invalid")
+         else:
+             if ret == -1:
+-                err = ctypes.c_int.in_dll(_lib, "errno")
++                err = ctypes.c_int.in_dll(_libc, "__errno")
+                 if err.value == errno.EINVAL:
+                     raise CanvasError("At least one of the colour values"
+                                       " is invalid")
+@@ -1223,7 +1223,7 @@ class Canvas(_Canvas):
+         except ctypes.ArgumentError:
+             raise CanvasError("specified index is invalid")
+         else:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if err.value == errno.EINVAL:
+                 raise CanvasError("Requested frame is out of range")
+             else:
+@@ -1256,7 +1256,7 @@ class Canvas(_Canvas):
+         except ctypes.ArgumentError:
+             raise CanvasError("Specified name is invalid")
+         else:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if err.value == errno.ENOMEM:
+                 raise CanvasError("Not enough memory to allocate new frame")
+             else:
+@@ -1275,7 +1275,7 @@ class Canvas(_Canvas):
+         except ctypes.ArgumentError:
+             raise CanvasError("specified index is invalid")
+         else:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if err.value == errno.ENOMEM:
+                 raise CanvasError("Not enough memory to allocate new frame")
+             else:
+@@ -1294,7 +1294,7 @@ class Canvas(_Canvas):
+         except ctypes.ArgumentError:
+             raise CanvasError("specified index is invalid")
+         else:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if err.value == errno.EINVAL:
+                 raise CanvasError("Requested frame is out of range, or attempt"
+                                   " to delete the last frame of the canvas")
+@@ -1334,7 +1334,7 @@ class Canvas(_Canvas):
+         except ctypes.ArgumentError:
+             raise CanvasError("Given data are invalid")
+         else:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if ret == -1:
+                 if err.value == errno.ENOMEM:
+                     raise CanvasError("Not enough memory to allocate canvas")
+@@ -1371,7 +1371,7 @@ class Canvas(_Canvas):
+         except ctypes.ArgumentError:
+             raise CanvasError("Specified filename is invalid")
+         else:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if ret == -1:
+                 if err.value == errno.ENOSYS:
+                     raise CanvasError("File access is not implemented on this"
+@@ -1419,7 +1419,7 @@ class Canvas(_Canvas):
+             raise CanvasError("Specified coordinate X or Y is invalid")
+         else:
+             if ret == -1:
+-                err = ctypes.c_int.in_dll(_lib, "errno")
++                err = ctypes.c_int.in_dll(_libc, "__errno")
+                 if err.value == errno.EINVAL:
+                     raise CanvasError("Unsupported format requested or"
+                                       " invalid coordinates")
+@@ -1460,7 +1460,7 @@ class Canvas(_Canvas):
+             raise CanvasError("Specified coordinate X or Y is invalid")
+         else:
+             if ret == -1:
+-                err = ctypes.c_int.in_dll(_lib, "errno")
++                err = ctypes.c_int.in_dll(_libc, "__errno")
+                 if err.value == errno.ENOSYS:
+                     raise CanvasError("File access is not implemented on this"
+                                       " system")
+@@ -1506,7 +1506,7 @@ class Canvas(_Canvas):
+             raise CanvasError("Invalid format requested")
+         else:
+             if not ret:
+-                err = ctypes.c_int.in_dll(_lib, "errno")
++                err = ctypes.c_int.in_dll(_libc, "__errno")
+                 if err.value == errno.EINVAL:
+                     raise CanvasError("Invalid format requested")
+                 elif err.value == errno.ENOMEM:
+@@ -1558,7 +1558,7 @@ class Canvas(_Canvas):
+             raise CanvasError("Requested area coordinate is invalid")
+         else:
+             if not ret:
+-                err = ctypes.c_int.in_dll(_lib, "errno")
++                err = ctypes.c_int.in_dll(_libc, "__errno")
+                 if err.value == errno.EINVAL:
+                     raise CanvasError("Invalid format requested")
+                 elif err.value == errno.ENOMEM:
+--- origsrc/libcaca-0.99.beta18/python/caca/font.py    2012-04-06 13:46:08.000000000 -0500
++++ src/libcaca-0.99.beta18/python/caca/font.py        2012-08-26 22:41:44.365310200 -0500
+@@ -17,7 +17,7 @@
+ import ctypes
+ import errno
+-from caca import _lib, _PYTHON3, _str_to_bytes
++from caca import _lib, _libc, _PYTHON3, _str_to_bytes
+ class _Font(object):
+     """ Model for Font object.
+@@ -69,7 +69,7 @@ class Font(_Font):
+         self._font = _lib.caca_load_font(font, size)
+         if self._font == 0:
+-            err = ctypes.c_int.in_dll(_lib, "errno")
++            err = ctypes.c_int.in_dll(_libc, "__errno")
+             if err.value == errno.ENOENT:
+                 raise FontError("Requested built-in font does not exist")
+             elif err.value == errno.EINVAL:
index 885d0441235c263ce19929ccd65f1b1b108d73f6..6010d07b7100c2d68e7ce5c8ecaa01b60601ca9e 100644 (file)
@@ -15,6 +15,7 @@ PATCH_URI="
        0.99.16-ruby.patch
        0.99.18-java.patch
        0.99.18-ncurses6.patch
+       0.99.18-python-errno.patch
        0.99.18-ruby19.patch
 "
 
This page took 0.024561 seconds and 5 git commands to generate.