After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 699856 - Fixes and features for the section parser
Fixes and features for the section parser
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-05-07 17:48 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2015-02-07 16:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sectionparser: Construct Subsections, not Sections (912 bytes, patch)
2013-05-07 17:48 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
sectionparser: Fix regex matching (1.37 KB, patch)
2013-05-07 17:48 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
sectionparser: Fix subsection regex (946 bytes, patch)
2013-05-07 17:49 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
sectionparser: Allow subsections with no name (1.04 KB, patch)
2013-05-07 17:49 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
sectionparser: Rename (899 bytes, patch)
2013-05-07 17:49 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
sectionparser: Add support for <INCLUDE> (1.21 KB, patch)
2013-05-07 17:49 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
sectionparser: Remove the main subsection (1.19 KB, patch)
2013-05-07 17:49 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
sectionparser: Ignore other directives to gtk-doc (895 bytes, patch)
2013-05-07 17:49 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
giscanner: Add a simple automatic sections file generator (17.61 KB, patch)
2013-05-07 17:49 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
giscanner: Add a simple automatic sections file generator (17.52 KB, patch)
2013-05-07 18:19 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2013-05-07 17:48:47 UTC
This will be used in upcoming doc work.
Comment 1 Jasper St. Pierre (not reading bugmail) 2013-05-07 17:48:49 UTC
Created attachment 243515 [details] [review]
sectionparser: Construct Subsections, not Sections

Whoops!
Comment 2 Jasper St. Pierre (not reading bugmail) 2013-05-07 17:48:53 UTC
Created attachment 243516 [details] [review]
sectionparser: Fix regex matching
Comment 3 Jasper St. Pierre (not reading bugmail) 2013-05-07 17:49:04 UTC
Created attachment 243517 [details] [review]
sectionparser: Fix subsection regex
Comment 4 Jasper St. Pierre (not reading bugmail) 2013-05-07 17:49:07 UTC
Created attachment 243518 [details] [review]
sectionparser: Allow subsections with no name
Comment 5 Jasper St. Pierre (not reading bugmail) 2013-05-07 17:49:10 UTC
Created attachment 243519 [details] [review]
sectionparser: Rename

It's called a sections file, not a section file.
Comment 6 Jasper St. Pierre (not reading bugmail) 2013-05-07 17:49:13 UTC
Created attachment 243520 [details] [review]
sectionparser: Add support for <INCLUDE>
Comment 7 Jasper St. Pierre (not reading bugmail) 2013-05-07 17:49:16 UTC
Created attachment 243521 [details] [review]
sectionparser: Remove the main subsection

This isn't how subsections work
Comment 8 Jasper St. Pierre (not reading bugmail) 2013-05-07 17:49:19 UTC
Created attachment 243522 [details] [review]
sectionparser: Ignore other directives to gtk-doc
Comment 9 Jasper St. Pierre (not reading bugmail) 2013-05-07 17:49:22 UTC
Created attachment 243524 [details] [review]
giscanner: Add a simple automatic sections file generator

This is a very basic sections file generator, and isn't too smart.
It's simply intended to be a base to build docs on, and will be used
if the user doesn't provide a sections file when calling g-ir-doc-tool,
for convenience purposes.
Comment 10 Colin Walters 2013-05-07 17:51:04 UTC
Review of attachment 243515 [details] [review]:

Makes sense.
Comment 11 Colin Walters 2013-05-07 17:53:19 UTC
Review of attachment 243516 [details] [review]:

Ouch, they were really inverted?  It's probably worth precompiling these; compiling regexps in a loop makes one look silly.
Comment 12 Colin Walters 2013-05-07 17:55:19 UTC
Review of attachment 243517 [details] [review]:

::: giscanner/sectionparser.py
@@ +67,3 @@
             continue
 
+        match = re.match(r"<SUBSECTION (?P<name>.*)>", line)

As a general rule I'd use non-greedy here, i.e. ".*?".
Comment 13 Colin Walters 2013-05-07 17:56:04 UTC
Review of attachment 243518 [details] [review]:

Ok.
Comment 14 Colin Walters 2013-05-07 17:56:17 UTC
Review of attachment 243519 [details] [review]:

Sure.
Comment 15 Colin Walters 2013-05-07 17:58:45 UTC
Review of attachment 243520 [details] [review]:

Ok.
Comment 16 Colin Walters 2013-05-07 17:59:16 UTC
Review of attachment 243521 [details] [review]:

Sounds plausible.
Comment 17 Colin Walters 2013-05-07 18:00:09 UTC
Review of attachment 243522 [details] [review]:

I'll trust you on this.
Comment 18 Colin Walters 2013-05-07 18:02:25 UTC
Review of attachment 243524 [details] [review]:

One comment.

::: giscanner/sectionparser.py
@@ +116,3 @@
+                write(symbol)
+
+    return '\n' + '\n'.join(lines).strip() + '\n'

Building up a potentially large string in memory is lame.  Why doesn't this function take a stream?
Comment 19 Jasper St. Pierre (not reading bugmail) 2013-05-07 18:04:31 UTC
(In reply to comment #11)
> Review of attachment 243516 [details] [review]:
> 
> Ouch, they were really inverted?  It's probably worth precompiling these;
> compiling regexps in a loop makes one look silly.

Python caches compiled regexes at first use. re.compile isn't really a thing to use anymore.

(In reply to comment #12)
> Review of attachment 243517 [details] [review]:
> 
> ::: giscanner/sectionparser.py
> @@ +67,3 @@
>              continue
> 
> +        match = re.match(r"<SUBSECTION (?P<name>.*)>", line)
> 
> As a general rule I'd use non-greedy here, i.e. ".*?".

From how I understand it, that's not what the Perl script does. See gtkdoc-mkdb.in.

(In reply to comment #18)
> Review of attachment 243524 [details] [review]:
> 
> One comment.
> 
> ::: giscanner/sectionparser.py
> @@ +116,3 @@
> +                write(symbol)
> +
> +    return '\n' + '\n'.join(lines).strip() + '\n'
> 
> Building up a potentially large string in memory is lame.  Why doesn't this
> function take a stream?

So I could verify the output simply by printing the entire thing to stdout. I'll fix it.
Comment 20 Jasper St. Pierre (not reading bugmail) 2013-05-07 18:19:52 UTC
Created attachment 243526 [details] [review]
giscanner: Add a simple automatic sections file generator

This is a very basic sections file generator, and isn't too smart.
It's simply intended to be a base to build docs on, and will be used
if the user doesn't provide a sections file when calling g-ir-doc-tool,
for convenience purposes.
Comment 21 Jasper St. Pierre (not reading bugmail) 2013-05-07 18:26:28 UTC
Attachment 243515 [details] pushed as 88c747c - sectionparser: Construct Subsections, not Sections
Attachment 243516 [details] pushed as 4062357 - sectionparser: Fix regex matching
Attachment 243517 [details] pushed as a1a513a - sectionparser: Fix subsection regex
Attachment 243518 [details] pushed as af0158e - sectionparser: Allow subsections with no name
Attachment 243519 [details] pushed as 6c6b787 - sectionparser: Rename
Attachment 243520 [details] pushed as 95b18d1 - sectionparser: Add support for <INCLUDE>
Attachment 243521 [details] pushed as 190d9a5 - sectionparser: Remove the main subsection
Attachment 243522 [details] pushed as 348c72a - sectionparser: Ignore other directives to gtk-doc


Pushing the fixes for now.
Comment 22 Colin Walters 2013-05-07 21:11:55 UTC
Review of attachment 243526 [details] [review]:

One minor thing, otherwise looks fine.

::: giscanner/docmain.py
@@ +41,3 @@
+    parser.add_option("", "--write-sections-file",
+                      action="store_true", dest="write_sections",
+                      help="Write the loaded or generation sections file")

s/generation/generated/?
Comment 23 Jasper St. Pierre (not reading bugmail) 2013-06-16 05:20:22 UTC
Attachment 243526 [details] pushed as 3ec52d6 - giscanner: Add a simple automatic sections file generator


It seems I forgot to push this one.
Comment 24 André Klapper 2015-02-07 16:58:03 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]