[PySide] building PySide 1.1.1 against Qt 4.8.1 on windows a kind of solution

Bjørn Helge Kjøsnes bjelge at nefines.com
Wed May 2 09:19:21 CEST 2012


Hi,

after some more digging I am able to compile and run PySide 1.1.1 
against Qt 4.8.1.

It is a ugly solution that can not be committed to the repos, but for if 
there are any in need for a version, you can replace a few lines of code 
in shiboken-1.1.1\generator\shiboken\cppgenerator.cpp file.

Locate line 287 and replace:
&& (func->name() != "qt_metacall"))
  overloads.append(func);

with:
&& (func->name() != "qt_metacall")){
   if (func->toString().contains("open")) {
     if (func->isVirtual())
       overloads.append(func);
   }
   else
     overloads.append(func);
}

and before any say anything about the method, I know it is ugly and 
should be avoided. I do it like this to avoid to many side effects until 
I understand how it should be done. May me anybody can help out here. 
The problem in Windows are that the code generated for the overload 
wrappers are not getting only the methods that there are generated 
headers and source code for. In QFile you have at least 6 open methods 
with 1 to 3 parameters that are overloaded. In PySide only 2 of these 
survives into the wrappers. The code writing method handling the 
overload do not see that some of the methods might get filtered out by 
the avoidProtectedHack.

see line 258 in the cppgenerator.cpp file:
else if ((!avoidProtectedHack() || !metaClass->hasPrivateDestructor())
&& (func->isVirtual() || func->isAbstract()))
   writeVirtualMethodNative(s, func);

The makes shiboken not render code for 3 out of 4 overloads of open in 
QFile. Can anybody tell me if this is what the avoid protected hack is 
all about, skipping implementation of methods in Windows that not meet 
certain requirements? If so, why is that done and is there anything I 
can do to help fix that?  Is there anywhere I can find information of 
how things are implemented and why. I feel I start to understand how the 
code generating is done and I will probably start using this instead of 
my hand-crafted wrappers written in pycxx when I can find the time.

Kind regards,
Bjorn Helge Kjosnes

On 01.05.2012 19:13, Bjørn Helge Kjøsnes wrote:
> Hi,
>
> I have spent some time to figure out why this error is happening, but
> progress is slow due to total lack of experience with shiboken code and
> the type system and how to best debug this on Windows, so any help would
> be appreciated.
>
> So far I have found that it is the new open methods in QFile and in
> QFSFileEngine that not are added to the generated wrappers. It is only
> one open method added from the class and one for the parent class. The
> reason for these open methods not being added is that they have been
> marked by the apiextractor to have the Final flag set and therefor
> skipped in the CppGenerator::generateClass method. The code expecting to
> use these method to support overloaded methods in Python are generating
> code expecting these methods.
>
> The code where generating of code is skipped are in cppgenerator.cpp
> around line 250:
>               else if ((!avoidProtectedHack() ||
> !metaClass->hasPrivateDestructor())
> &&  (func->isVirtual() || func->isAbstract()))
>                   writeVirtualMethodNative(s, func);
>
> The func->isVirtual() returns true because the final flag is set and not
> because it is a virtual method.
>
> I am now trying to figure out why the Final flag is set in these
> methods, so if anybody can point me to where this is done, please do so.
>
> Thanks,
> Bjorn Helge Kjosnes
>
> On 01.05.2012 18:20, Joel B. Mohler wrote:
>> Hello,
>>
>> The old bugtracker has http://bugs.pyside.org/show_bug.cgi?id=1079
>> closed due to the move to qt-project.  I'm now trying the build as
>> according to http://qt-project.org/wiki/Building_PySide_on_Windows and
>> running into this same bug.
>>
>> I'm going to report it on on the new tracker and make an effort to fix
>> it myself, but I would appreciate if anybody else has some sort of
>> progress on a fix to relay any pointers.
>>
>> Thanks,
>> Joel
>>
>> _______________________________________________
>> PySide mailing list
>> PySide at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/pyside
>>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
>




More information about the PySide mailing list