[PyQt] pyrcc: "-name" does not do anything

Phil Thompson phil at riverbankcomputing.com
Tue Jul 25 09:32:15 BST 2017


On 23 Jul 2017, at 10:52 pm, Anonymous Maarten <anonymous.maarten at gmail.com> wrote:
> 
> 
> On 22 July 2017 at 11:34, Phil Thompson <phil at riverbankcomputing.com> wrote:
> On 20 Jul 2017, at 5:29 pm, Maarten Anonymous <anonymous.maarten at gmail.com> wrote:
> >
> > Hey,
> >
> > The -name argument of pyrcc does not do anything.
> 
> It never has done.
> Will it ever? Maybe print a warning? 
> 
> > When looking at the sources,
> > the `mInitName` member of `RCCFileInfo` in https://github.com/baoboa/pyqt5/blob/d9f32341e81ff3c29269c738cdfc1ba8b73db1f3/pyrcc/rcc.cpp and https://github.com/baoboa/pyqt5/blob/d9f32341e81ff3c29269c738cdfc1ba8b73db1f3/pyrcc/rcc.h#L80-L81 is not used anywhere.
> >
> > That makes it impossible in Python to import a rc module without registering it immediately.
> 
> I don't see how fixing -name would make any difference.
> 
> pyrcc -h says the -name flag creates an external initialization function with name.
> My interpretation of that flag was that it could change the name of the qInitResources and qCleanupSources functions (and not automatically call them). 
> 
> I'm happy to add a new flag that suppresses the call to the registration function so that you can call it yourself later on.
>  
> That would completely solve my initial problem.
> Right now I am importing the resources module but not using any function.
> Linters are complaining that I am not using that module.

Sorry, I've changed my mind on this. If the problem is wanting to delay the registration then delay the import.

If the problem is complaints from a linter then that's the linter's problem as importing a module but doing nothing else with it is perfectly reasonable IMHO.

Phil



More information about the PyQt mailing list