qrc_emitter missing from the Qrc4 builder

Bug #674916 reported by Gerhard Dirschl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SCons Qt4 Tool
Fix Released
High
Dirk Baechle

Bug Description

The (explicit) Qrc4 builder is missing the __qrc_emitter.

--- release_13072010.py 2010-11-05 10:41:24.441051117 +0100
+++ qt4.py 2010-11-10 13:49:55.610526010 +0100
@@ -534,6 +534,7 @@
         suffix = '.qm')
 __qrc_builder = SCons.Builder.Builder(
         action = SCons.Action.CommandGeneratorAction(__qrc_generator, {}),
+ emitter = __qrc_emitter,
         source_scanner = __qrcscanner,
         src_suffix = '$QT4_QRCSUFFIX',
         suffix = '$QT4_QRCCXXSUFFIX',

Revision history for this message
Dirk Baechle (dl9obn) wrote :

Hi Gerhard,

I had a first short look at your bug report. Can you please explain, in a little more detail, how the error/bug looks like on your side? What are you trying to do, and how does it fail (exact error message)? It would be awesome if you could prepare a small testcase...

Best regards,

Dirk

Revision history for this message
Gerhard Dirschl (devel-spherenet) wrote :

Hi Dirk

I thought it was obvious so I didn't add more details.
I've attached a very short test case which shows the problem (qt4 Tool 0.1 is included).
The C++ file generated by env.Qrc4(...) has the wrong suffix. It should be '.cc' but it is '.qrc' (just as the input file). If I stick that output file into an env.Object() Builder (or env.SharedLibrary(), or env.Program()...), the attached qrc source file builder is called again and tries to translate the C++ file (because of the suffix).

The env.Qrc4(...) uses the wrong filename because it has no emitter attached. Adding __qrc_emitter to the builder fixes the problem.
The bug applies only to the explicit env.Qrc4(...) builder. The .qrc source file builder (the one attached to env.Object(), env.Program()) is not affected. Passing the input file test.qrc directly to env.Object(...) works perfectly.

Revision history for this message
Dirk Baechle (dl9obn) wrote :

Thanks for the test case.... You are right, there is a bug. But it's not in the builder/emitter, it's in the manual: please say

  env.Qrc4('test')

and you should get what you want.
The point is, that the Qrc4 builder sees that only a target (and no source) is specified. Then it simply copies the list of targets to source, so in your test case you effectively get an "env.Qrc4('test.qrc','test.qrc')". Although the proper prefixes and suffixes are specified for the Builder, SCons will not touch the target's name...it already has an extension.
One could add the "ensure_suffix" option, but then we would get "test.qrc.cc" as output...not nice.
The emitter function is only there for the automatic Qrc action that gets attached to the static/shared object builders, and is needed in this case to ensure the proper names (especially the qrc_ prefix to avoid name clashes) for the resulting files.

I'll fix the manual and upload a new version as soon as possible.

Best regards,

Dirk

Changed in scons-qt4:
assignee: nobody → Dirk Baechle (dl9obn)
importance: Undecided → High
status: New → In Progress
Revision history for this message
Gerhard Dirschl (devel-spherenet) wrote :

Thanks for the explanation. I will update my project and revert my "fix".
I was using a quite old revision of the qt4 scons tool from one of the different branches. Back then the builder was named env.Qrc and worked when specifying the source file (I don't know if it was meant to work this way but it worked). Then I upgraded to Release 0.1, renamed env.Qrc to env.Qrc4 and ... failure.

Revision history for this message
Dirk Baechle (dl9obn) wrote :

Updated documentation and released a new tarball as milestone/release v0.2.

Changed in scons-qt4:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.