Gentoo Archives: gentoo-commits

From: Alexandre Restovtsev <tetromino@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gnome:gnome-next commit in: dev-libs/gobject-introspection/files/, dev-libs/gobject-introspection/
Date: Tue, 30 Aug 2011 10:03:58
Message-Id: 059cf1665a99c6d65ad836a65464ec38a8b3d4b9.tetromino@gentoo
1 commit: 059cf1665a99c6d65ad836a65464ec38a8b3d4b9
2 Author: Alexandre Rostovtsev <tetromino <AT> gmail <DOT> com>
3 AuthorDate: Tue Aug 30 09:36:35 2011 +0000
4 Commit: Alexandre Restovtsev <tetromino <AT> gmail <DOT> com>
5 CommitDate: Tue Aug 30 10:02:03 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=059cf166
7
8 dev-libs/gobject-introspection: 1.29.16 → 1.29.17
9
10 Version bump with numerous changes, including a new documentation
11 generator tool. Tests patch was applied upstream.
12
13 For some reason, the docbookdescription.py file is missing from the
14 tarball, so we have to ship it in FILESDIR. See upstream bug 657686.
15
16 ---
17 .../files/1.29.17-docbookdescription.py | 185 ++++++++++++++++++++
18 .../gobject-introspection-0.10.8-make-check.patch | 110 ------------
19 ...ebuild => gobject-introspection-1.29.17.ebuild} | 16 +-
20 .../gobject-introspection-9999.ebuild | 8 +-
21 4 files changed, 197 insertions(+), 122 deletions(-)
22
23 diff --git a/dev-libs/gobject-introspection/files/1.29.17-docbookdescription.py b/dev-libs/gobject-introspection/files/1.29.17-docbookdescription.py
24 new file mode 100644
25 index 0000000..9ec7219
26 --- /dev/null
27 +++ b/dev-libs/gobject-introspection/files/1.29.17-docbookdescription.py
28 @@ -0,0 +1,185 @@
29 +
30 +TAG_PROGRAM_LISTING = '<programlisting'
31 +TAG_CDATA = '<![CDATA['
32 +TAGS = {TAG_PROGRAM_LISTING, TAG_CDATA, ']]>', '</programlisting>'}
33 +
34 +def get_formatted_description(description):
35 + desc = description.replace("|[", "<informalexample><programlisting>") \
36 + .replace("]|", "</programlisting></informalexample>")
37 +
38 + desc = "<para>%s</para>" % desc
39 +
40 +# we still need to handle this case
41 +# # Handle "#include <xxxxx>"
42 +# $text =~ s/#include(\s+)<([^>]+)>/#include$1&lt;$2&gt;/g;
43 +
44 + formatted_desc = ""
45 +
46 + inside_tags = []
47 + last_offset = 0
48 + for start, end, tag in _find_xml_tag_matches(desc):
49 + if len(inside_tags) == 0:
50 + new_desc = "\n</para>\n<para>\n".join(desc[last_offset:start].split('\n\n'))
51 + else:
52 + new_desc = desc[last_offset:start]
53 +
54 + if TAG_CDATA not in inside_tags:
55 + new_desc = _escape_non_cdata_section(new_desc)
56 +
57 + formatted_desc += new_desc
58 + formatted_desc += tag
59 + if tag == TAG_PROGRAM_LISTING:
60 + formatted_desc += '>'
61 +
62 + if tag in (TAG_CDATA, TAG_PROGRAM_LISTING):
63 + inside_tags.append(tag)
64 + else:
65 + try:
66 + inside_tags.pop()
67 + except IndexError:
68 + print "Error: mismatched tag:", tag
69 + last_offset = end
70 +
71 + formatted_desc += _escape_non_cdata_section(desc[last_offset:])
72 + return formatted_desc
73 +
74 +def _find_xml_tag_matches(string):
75 + offset = 0
76 + while True:
77 + indexes = []
78 + for tag in TAGS:
79 + pos = string.find(tag, offset)
80 + if pos != -1:
81 + indexes.append((tag, pos))
82 +
83 + if indexes:
84 + tag, first = min(indexes, key=lambda x: x[1])
85 + if tag == TAG_PROGRAM_LISTING:
86 + end = string.find('>', first + len(tag) - 1) + 1
87 + else:
88 + end = first + len(tag)
89 + offset = end
90 + yield first, end, tag
91 + else:
92 + return
93 +
94 +def _escape_non_cdata_section(string):
95 + string = _escape_ampersand_not_in_entity(string)
96 + string = _escape_lt_not_in_xml_tag(string)
97 + return _escape_gt_not_in_xml_tag(string)
98 +
99 +def _escape_ampersand_not_in_entity(string):
100 + parts = string.split('&')
101 +
102 + output = parts[0]
103 + for part in parts[1:]:
104 + end = part.find(';')
105 + if end == -1 or not part[:end].isalpha():
106 + output += "&amp;"
107 + else:
108 + output += "&"
109 + output += part
110 +
111 + return output
112 +
113 +def _is_valid_xml_tag_name(name):
114 + if len(name) < 1:
115 + return False
116 + elif name.isalpha() or (name[0].isalpha() and name[1:].isalnum()):
117 + return True
118 +
119 +def _is_valid_xml_tag(string):
120 + # handle case where line end is between tag name and first argument.
121 + # ie. <link\nlinkend="link-id">My Link</link>
122 + string = string.replace('\n', ' ')
123 +
124 + if string[-1] == '/':
125 + string = string[:-1]
126 +
127 + # string is the inner part of the tag, without < and >
128 + if string[0] == '/' and _is_valid_xml_tag_name(string[1:]):
129 + #valid end tag
130 + return True
131 + elif _is_valid_xml_tag_name(string):
132 + #valid start tag with not params
133 + return True
134 + elif " " in string:
135 + # we are looking for: <tagname arg="value" arg2="value2">
136 + # TODO: handle spaces in values (between quotations)
137 + tagname, rest = string.split(" ", 1)
138 + if not _is_valid_xml_tag_name(tagname):
139 + return False
140 +
141 + while rest.strip():
142 + rest = rest.lstrip()
143 +
144 + if not '=' in rest:
145 + return False
146 + argname, rest = rest.split('=', 1)
147 + if not _is_valid_xml_tag_name(argname):
148 + return False
149 + if rest[0] != '"':
150 + return False
151 + value, rest = rest[1:].split('"', 1)
152 +
153 + return True
154 +
155 +def _escape_lt_not_in_xml_tag(string):
156 + parts = string.split('<')
157 +
158 + output = parts[0]
159 + for part in parts[1:]:
160 + end = part.find('>')
161 + if end == -1 or not _is_valid_xml_tag(part[:end]):
162 + output += "&lt;"
163 + else:
164 + output += "<"
165 + output += part
166 +
167 + return output
168 +
169 +def _escape_gt_not_in_xml_tag(string):
170 + parts = string.split('>')
171 +
172 + output = parts[0]
173 + for part in parts[1:]:
174 + start = output.rfind('<')
175 + if start == -1 or not _is_valid_xml_tag(output[start+1:]):
176 + output += "&gt;"
177 + else:
178 + output += ">"
179 + output += part
180 +
181 + return output
182 +
183 +
184 +def test():
185 + assert _is_valid_xml_tag_name('a')
186 + assert _is_valid_xml_tag_name('refsect1')
187 + assert not _is_valid_xml_tag_name('1refsect')
188 + assert not _is_valid_xml_tag_name('1')
189 +
190 + assert _is_valid_xml_tag('/a')
191 + assert _is_valid_xml_tag('/refsect1')
192 + assert not _is_valid_xml_tag('/1')
193 + assert _is_valid_xml_tag('link')
194 + assert _is_valid_xml_tag('link linkend="value"')
195 + assert _is_valid_xml_tag('link linkend="value"')
196 + assert _is_valid_xml_tag('link/')
197 + assert _is_valid_xml_tag('link linkend="value"/')
198 + assert _is_valid_xml_tag('link linkend="value" arg23="anothervalue"')
199 + assert _is_valid_xml_tag('link linkend="value" arg23="anothervalue with spaces"')
200 + assert not _is_valid_xml_tag('link linkend="value arg23="anothervalue with spaces"')
201 + assert not _is_valid_xml_tag('link linkend')
202 + assert _is_valid_xml_tag('link\nlinkend="link-id"')
203 + assert _is_valid_xml_tag('xref linkend="gtkstylecontext-classes"/')
204 +
205 + assert _is_valid_xml_tag('a href="http://www.gtk.org" title="&lt;i&gt;Our&lt;/i&gt; website"')
206 + assert _is_valid_xml_tag('ulink \nurl="http://www.freedesktop.org/Standards/wm-spec"')
207 +
208 + string = 'gtk_label_set_markup (label, "Go to the <a href="http://www.gtk.org" ' \
209 + + 'title="&lt;i&gt;Our&lt;/i&gt; website">GTK+ website</a> for more...");'
210 + assert _escape_lt_not_in_xml_tag(string) == string
211 +
212 +if __name__ == '__main__':
213 + test()
214
215 diff --git a/dev-libs/gobject-introspection/files/gobject-introspection-0.10.8-make-check.patch b/dev-libs/gobject-introspection/files/gobject-introspection-0.10.8-make-check.patch
216 deleted file mode 100644
217 index 546c9c6..0000000
218 --- a/dev-libs/gobject-introspection/files/gobject-introspection-0.10.8-make-check.patch
219 +++ /dev/null
220 @@ -1,110 +0,0 @@
221 -From a71d73bf633d83c6a7f457c1f0acba378289f4c8 Mon Sep 17 00:00:00 2001
222 -From: Alexandre Rostovtsev <tetromino@×××××.com>
223 -Date: Mon, 22 Aug 2011 02:49:51 -0400
224 -Subject: [PATCH] tests: build tests only on make check
225 -
226 -Use automake's check_ prefix and avoid putting anything nontrivial in
227 -BUILT_SOURCES so that tests are build only on make check.
228 -
229 -The dummy -rpath in AM_LDFLAGS in tests/scanner/Makefile.am is needed to
230 -force libtool to build shared libraries for check_LTLIBRARIESS targets
231 -(automake builds check_LTLIBRARIES as static by default); see
232 -http://lists.gnu.org/archive/html/automake/2005-10/msg00107.html
233 -
234 -Addresses https://bugzilla.gnome.org/show_bug.cgi?id=657066
235 ----
236 - tests/Makefile.am | 6 ++----
237 - tests/repository/Makefile.am | 2 +-
238 - tests/scanner/Makefile.am | 16 ++++++----------
239 - 3 files changed, 9 insertions(+), 15 deletions(-)
240 -
241 -diff --git a/tests/Makefile.am b/tests/Makefile.am
242 -index 20ecc17..2d395a3 100644
243 ---- a/tests/Makefile.am
244 -+++ b/tests/Makefile.am
245 -@@ -16,16 +16,14 @@ tests_DATA = \
246 - gimarshallingtests.c \
247 - gimarshallingtests.h
248 -
249 --testlib_LTLIBRARIES = libeverything-1.0.la libgimarshallingtests-1.0.la
250 --testlibdir=$(prefix)/unused
251 --install-testlibLTLIBRARIES: # prevent it from being installed
252 -+check_LTLIBRARIES = libeverything-1.0.la libgimarshallingtests-1.0.la
253 -
254 - libeverything_1_0_la_SOURCES = everything.c
255 - libgimarshallingtests_1_0_la_SOURCES = gimarshallingtests.c
256 -
257 - EXTRA_DIST += gimarshallingtests.h
258 -
259 --BUILT_SOURCES += everything.c everything.h Everything-1.0.gir GIMarshallingTests-1.0.gir
260 -+BUILT_SOURCES += everything.c everything.h
261 -
262 - CLEANFILES += \
263 - $(BUILT_SOURCES) \
264 -diff --git a/tests/repository/Makefile.am b/tests/repository/Makefile.am
265 -index 268d9f9..ffc635f 100644
266 ---- a/tests/repository/Makefile.am
267 -+++ b/tests/repository/Makefile.am
268 -@@ -2,7 +2,7 @@ AM_CFLAGS = $(GOBJECT_CFLAGS)
269 - AM_LDFLAGS = -module -avoid-version
270 - LIBS = $(GOBJECT_LIBS)
271 -
272 --noinst_PROGRAMS = gitestrepo gitestthrows gitypelibtest
273 -+check_PROGRAMS = gitestrepo gitestthrows gitypelibtest
274 -
275 - gitestrepo_SOURCES = $(srcdir)/gitestrepo.c
276 - gitestrepo_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
277 -diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am
278 -index 6b78ee7..fc2e260 100644
279 ---- a/tests/scanner/Makefile.am
280 -+++ b/tests/scanner/Makefile.am
281 -@@ -3,24 +3,21 @@ include $(top_srcdir)/Makefile.introspection
282 -
283 - INTROSPECTION_SCANNER_ARGS += --warn-all --warn-error -I.
284 -
285 --# We need to build a shared library, which can be dlopened
286 --# it does not work with noinst_LTLIBRARIES
287 --testlib_LTLIBRARIES = \
288 -+check_LTLIBRARIES = \
289 - libannotation.la \
290 - libtestinherit.la \
291 - libfoo.la \
292 - libutility.la \
293 - libgtkfrob.la
294 - if HAVE_CAIRO
295 --testlib_LTLIBRARIES += libregress.la
296 -+check_LTLIBRARIES += libregress.la
297 - endif
298 -
299 --testlibdir = $(prefix)/unused
300 --install-testlibLTLIBRARIES: # prevent it from being installed
301 --
302 - AM_CPPFLAGS = -I$(top_srcdir)/girepository
303 - AM_CFLAGS = $(GIO_CFLAGS) $(GOBJECT_CFLAGS) $(GTHREAD_CFLAGS)
304 --AM_LDFLAGS = -avoid-version
305 -+# -rpath needed to force libtool to build a shared library for a check_LTLIBRARIES
306 -+# target. See http://lists.gnu.org/archive/html/automake/2005-10/msg00107.html
307 -+AM_LDFLAGS = -rpath /unused -avoid-version
308 - LIBS = $(GOBJECT_LIBS) $(GTHREAD_LIBS)
309 -
310 - libannotation_la_SOURCES = $(srcdir)/annotation.c $(srcdir)/annotation.h
311 -@@ -49,7 +46,6 @@ CHECKGIRS = $(GIRS:.gir=.gir.check)
312 - EXPECTEDGIRS = $(GIRS:.gir=-expected.gir)
313 - INTROSPECTION_GIRS = $(GIRS)
314 - CLEANFILES = $(TYPELIBS) $(GIRS)
315 --BUILT_SOURCES = $(TYPELIBS) $(GIRS)
316 - EXTRA_DIST = $(EXPECTEDGIRS)
317 -
318 - Regress-1.0.gir: $(top_builddir)/Gio-2.0.gir libregress.la
319 -@@ -102,7 +98,7 @@ GtkFrob_1_0_gir_FILES = $(libgtkfrob_la_SOURCES)
320 - GtkFrob_1_0_gir_SCANNERFLAGS = --identifier-prefix=Gtk --symbol-prefix=gtk_frob
321 - GIRS += GtkFrob-1.0.gir
322 -
323 --noinst_PROGRAMS = barapp
324 -+check_PROGRAMS = barapp
325 -
326 - barapp_SOURCES = $(srcdir)/barapp.c $(srcdir)/barapp.h
327 - barapp_LDADD = $(top_builddir)/libgirepository-1.0.la
328 ---
329 -1.7.6
330 -
331
332 diff --git a/dev-libs/gobject-introspection/gobject-introspection-1.29.16.ebuild b/dev-libs/gobject-introspection/gobject-introspection-1.29.17.ebuild
333 similarity index 81%
334 rename from dev-libs/gobject-introspection/gobject-introspection-1.29.16.ebuild
335 rename to dev-libs/gobject-introspection/gobject-introspection-1.29.17.ebuild
336 index 2b3aa4b..0346999 100644
337 --- a/dev-libs/gobject-introspection/gobject-introspection-1.29.16.ebuild
338 +++ b/dev-libs/gobject-introspection/gobject-introspection-1.29.17.ebuild
339 @@ -8,7 +8,7 @@ GNOME_TARBALL_SUFFIX="xz"
340 GNOME2_LA_PUNT="yes"
341 PYTHON_DEPEND="2:2.5"
342
343 -inherit autotools eutils gnome2 python
344 +inherit gnome2 python
345 if [[ ${PV} = 9999 ]]; then
346 inherit gnome2-live
347 fi
348 @@ -32,7 +32,7 @@ DEPEND="${RDEPEND}
349 dev-util/pkgconfig
350 sys-devel/bison
351 sys-devel/flex
352 - doc? ( >=dev-util/gtk-doc-1.12 )
353 + doc? ( >=dev-util/gtk-doc-1.15 )
354 test? ( x11-libs/cairo )"
355
356 pkg_setup() {
357 @@ -50,18 +50,18 @@ src_prepare() {
358
359 # Don't pre-compile .py
360 ln -sf $(type -P true) py-compile
361 -
362 - # Don't build tests when FEATURES=-test; bug #379929
363 - epatch "${FILESDIR}/${PN}-0.10.8-make-check.patch"
364 - eautoreconf
365 + ln -sf $(type -P true) build-aux/py-compile
366
367 gnome2_src_prepare
368 }
369
370 src_install() {
371 gnome2_src_install
372 - python_convert_shebangs 2 "${ED}"usr/bin/g-ir-scanner
373 - python_convert_shebangs 2 "${ED}"usr/bin/g-ir-annotation-tool
374 + python_convert_shebangs 2 "${ED}"usr/bin/g-ir-{annotation-tool,doc-tool,scanner}
375 +
376 + # https://bugzilla.gnome.org/show_bug.cgi?id=657686
377 + insinto /usr/$(get_libdir)/${PN}/giscanner
378 + newins "${FILESDIR}/${PV}-docbookdescription.py" docbookdescription.py
379 }
380
381 pkg_postinst() {
382
383 diff --git a/dev-libs/gobject-introspection/gobject-introspection-9999.ebuild b/dev-libs/gobject-introspection/gobject-introspection-9999.ebuild
384 index 70739cc..423d424 100644
385 --- a/dev-libs/gobject-introspection/gobject-introspection-9999.ebuild
386 +++ b/dev-libs/gobject-introspection/gobject-introspection-9999.ebuild
387 @@ -8,7 +8,7 @@ GNOME_TARBALL_SUFFIX="xz"
388 GNOME2_LA_PUNT="yes"
389 PYTHON_DEPEND="2:2.5"
390
391 -inherit gnome2 python libtool
392 +inherit gnome2 python
393 if [[ ${PV} = 9999 ]]; then
394 inherit gnome2-live
395 fi
396 @@ -32,7 +32,7 @@ DEPEND="${RDEPEND}
397 dev-util/pkgconfig
398 sys-devel/bison
399 sys-devel/flex
400 - doc? ( >=dev-util/gtk-doc-1.12 )
401 + doc? ( >=dev-util/gtk-doc-1.15 )
402 test? ( x11-libs/cairo )"
403
404 pkg_setup() {
405 @@ -50,14 +50,14 @@ src_prepare() {
406
407 # Don't pre-compile .py
408 ln -sf $(type -P true) py-compile
409 + ln -sf $(type -P true) build-aux/py-compile
410
411 gnome2_src_prepare
412 }
413
414 src_install() {
415 gnome2_src_install
416 - python_convert_shebangs 2 "${ED}"usr/bin/g-ir-scanner
417 - python_convert_shebangs 2 "${ED}"usr/bin/g-ir-annotation-tool
418 + python_convert_shebangs 2 "${ED}"usr/bin/g-ir-{annotation-tool,doc-tool,scanner}
419 }
420
421 pkg_postinst() {