python/pypoppler: Patched to build with poppler 0.16.

Patched for poppler 0.16 and added some upstream fixes.

Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
This commit is contained in:
dsomero 2011-03-28 01:26:21 -04:00 committed by Robby Workman
parent a496a5d054
commit 6e3ec235ef
6 changed files with 265 additions and 2 deletions

View file

@ -0,0 +1,66 @@
--- poppler.defs
+++ poppler.defs
@@ -1760,6 +1760,12 @@
(return-type "int")
)
+(define-method get_label
+ (of-object "PopplerPage")
+ (c-name "poppler_page_get_label")
+ (return-type "gchar*")
+)
+
(define-method get_duration
(of-object "PopplerPage")
(c-name "poppler_page_get_duration")
@@ -1805,9 +1811,15 @@
(of-object "PopplerPage")
(c-name "poppler_page_get_text")
(return-type "char*")
+)
+
+(define-method get_selected_text
+ (of-object "PopplerPage")
+ (c-name "poppler_page_get_selected_text")
+ (return-type "char*")
(parameters
'("PopplerSelectionStyle" "style")
- '("PopplerRectangle*" "rect")
+ '("PopplerRectangle*" "selection")
)
)
@@ -1895,6 +1907,16 @@
)
)
+(define-function poppler_page_add_annot
+ (of-object "PopplerPage")
+ (c-name "poppler_page_add_annot")
+ (return-type "none")
+ (parameters
+ '("PopplerAnnot*" "annot")
+ '("GList*" "list")
+ )
+)
+
(define-method get_crop_box
(of-object "PopplerPage")
(c-name "poppler_page_get_crop_box")
@@ -1904,6 +1926,16 @@
)
)
+(define-method get_text_layout
+ (of-object "PopplerPage")
+ (c-name "poppler_page_get_text_layout")
+ (return-type "gboolean")
+ (parameters
+ '("PopplerRectangle**" "rectangles")
+ '("guint*" "n_rectangles")
+ )
+)
+
(define-function poppler_rectangle_get_type
(c-name "poppler_rectangle_get_type")
(return-type "GType")

View file

@ -0,0 +1,73 @@
--- poppler.defs
+++ poppler.defs
@@ -1642,6 +1642,7 @@
(of-object "PopplerPage")
(c-name "poppler_page_render_to_pixbuf")
(return-type "none")
+ (unblock-threads #t)
(parameters
'("int" "src_x")
'("int" "src_y")
@@ -1657,6 +1658,7 @@
(of-object "PopplerPage")
(c-name "poppler_page_render_to_pixbuf_for_printing")
(return-type "none")
+ (unblock-threads #t)
(parameters
'("int" "src_x")
'("int" "src_y")
@@ -1672,12 +1674,14 @@
(of-object "PopplerPage")
(c-name "poppler_page_get_thumbnail_pixbuf")
(return-type "GdkPixbuf*")
+ (unblock-threads #t)
)
(define-method render_selection_to_pixbuf
(of-object "PopplerPage")
(c-name "poppler_page_render_selection_to_pixbuf")
(return-type "none")
+ (unblock-threads #t)
(parameters
'("gdouble" "scale")
'("int" "rotation")
@@ -1694,6 +1698,7 @@
(of-object "PopplerPage")
(c-name "poppler_page_render")
(return-type "none")
+ (unblock-threads #t)
(parameters
'("cairo_t*" "cairo")
)
@@ -1703,6 +1708,7 @@
(of-object "PopplerPage")
(c-name "poppler_page_render_for_printing")
(return-type "none")
+ (unblock-threads #t)
(parameters
'("cairo_t*" "cairo")
)
@@ -1712,12 +1718,14 @@
(of-object "PopplerPage")
(c-name "poppler_page_get_thumbnail")
(return-type "cairo_surface_t*")
+ (unblock-threads #t)
)
(define-method render_selection
(of-object "PopplerPage")
(c-name "poppler_page_render_selection")
(return-type "none")
+ (unblock-threads #t)
(parameters
'("cairo_t*" "cairo")
'("PopplerRectangle*" "selection")
@@ -1779,6 +1787,7 @@
(of-object "PopplerPage")
(c-name "poppler_page_render_to_ps")
(return-type "none")
+ (unblock-threads #t)
(parameters
'("PopplerPSFile*" "ps_file")
)

View file

@ -0,0 +1,66 @@
--- poppler.override
+++ poppler.override
@@ -600,3 +600,62 @@
return PycairoSurface_FromSurface(surface, NULL, NULL);
#endif
}
+%%
+override poppler_page_render_to_pixbuf kwargs
+static PyObject *
+_wrap_poppler_page_render_to_pixbuf(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "src_x", "src_y", "src_width",
+ "src_height", "scale", "rotation", NULL };
+ int src_x, src_y, src_width, src_height, rotation;
+ double scale;
+ GdkPixbuf *pixbuf = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "iiiidi:Poppler.Page.render_to_pixbuf",
+ kwlist, &src_x, &src_y, &src_width,
+ &src_height, &scale, &rotation))
+ return NULL;
+
+ pyg_begin_allow_threads;
+
+ poppler_page_render_to_pixbuf(POPPLER_PAGE(self->obj), src_x, src_y,
+ src_width, src_height, scale,
+ rotation, pixbuf);
+
+ pyg_end_allow_threads;
+
+ return pygobject_new((GObject *)pixbuf);
+}
+%%
+override poppler_page_render_to_pixbuf_for_printing kwargs
+static PyObject *
+_wrap_poppler_page_render_to_pixbuf_for_printing(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "src_x", "src_y", "src_width",
+ "src_height", "scale", "rotation", NULL };
+ int src_x, src_y, src_width, src_height, rotation;
+ double scale;
+ GdkPixbuf *pixbuf = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "iiiidi:Poppler.Page.render_to_pixbuf_for_printing",
+ kwlist, &src_x, &src_y, &src_width,
+ &src_height, &scale, &rotation))
+ return NULL;
+
+ pyg_begin_allow_threads;
+
+ poppler_page_render_to_pixbuf_for_printing(POPPLER_PAGE(self->obj),
+ src_x, src_y, src_width,
+ src_height, scale,
+ rotation, pixbuf);
+
+ pyg_end_allow_threads;
+
+ return pygobject_new((GObject *)pixbuf);
+}

View file

@ -0,0 +1,52 @@
--- poppler.override
+++ poppler.override
@@ -266,6 +266,12 @@
import gobject.GObject as PyGObject_Type
import gtk.gdk.Pixbuf as PyGdkPixbuf_Type
%%
+ignore
+poppler_page_free_link_mapping
+poppler_page_free_image_mapping
+poppler_page_free_form_field_mapping
+poppler_page_free_annot_mapping
+%%
ignore-glob
*_get_type
_*
@@ -359,7 +365,7 @@
item_list = poppler_page_get_link_mapping(POPPLER_PAGE(self->obj));
ret = _glist_to_pylist_boxed(item_list, POPPLER_TYPE_LINK_MAPPING);
- g_list_free(item_list);
+ poppler_page_free_link_mapping(item_list);
return ret;
}
%%
@@ -372,7 +378,7 @@
item_list = poppler_page_get_image_mapping(POPPLER_PAGE(self->obj));
ret = _glist_to_pylist_boxed(item_list, POPPLER_TYPE_IMAGE_MAPPING);
- g_list_free(item_list);
+ poppler_page_free_image_mapping(item_list);
return ret;
}
%%
@@ -385,7 +391,7 @@
item_list = poppler_page_get_form_field_mapping(POPPLER_PAGE(self->obj));
ret = _glist_to_pylist_boxed(item_list, POPPLER_TYPE_FORM_FIELD_MAPPING);
- g_list_free(item_list);
+ poppler_page_free_form_field_mapping(item_list);
return ret;
}
%%
@@ -398,7 +404,7 @@
item_list = poppler_page_get_annot_mapping(POPPLER_PAGE(self->obj));
ret = _glist_to_pylist_boxed(item_list, POPPLER_TYPE_ANNOT_MAPPING);
- g_list_free(item_list);
+ poppler_page_free_annot_mapping(item_list);
return ret;
}
%%

View file

@ -6,7 +6,7 @@
PRGNAM=pypoppler
VERSION=0.12.1
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -48,6 +48,12 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Fix building with poppler 0.15+ and some upstream fixes.
patch -p0 < $CWD/patches/pypoppler-0.12.1-75_74.diff
patch -p0 < $CWD/patches/pypoppler-0.12.1-76_75.diff
patch -p0 < $CWD/patches/pypoppler-0.12.1-79_78.diff
patch -p0 < $CWD/patches/poppler0.15.0-changes.patch
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \

View file

@ -7,4 +7,4 @@ DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
MAINTAINER="Larry Hajali"
EMAIL="larryhaja[at]gmail[dot]com"
APPROVED="rworkman"
APPROVED="dsomero"