(self, state: 'ModuleState', qt_dep: 'QtDependencyType')
Detect Qt (4 or 5) moc, uic, rcc in the specified bindir or in PATH
Detect Qt (4 or 5) moc, uic, rcc in the specified bindir or in PATH
Detect Qt ( 4 or 5 ) moc uic rcc in the specified bindir or in PATH
def compilers_detect(self, state: 'ModuleState', qt_dep: 'QtDependencyType') -> None:
        """Detect Qt (4 or 5) moc, uic, rcc in the specified bindir or in PATH"""
        # It is important that this list does not change order as the order of
        # the returned ExternalPrograms will change as well
        wanted = f'== {qt_dep.version}'

        def gen_bins() -> T.Generator[T.Tuple[str, str], None, None]:
            for b in self.tools:
                if qt_dep.bindir:
                    yield os.path.join(qt_dep.bindir, b), b
                # prefer the <tool>-qt<version> of the tool to the plain one, as we
                # don't know what the unsuffixed one points to without calling it.
                yield f'{b}-qt{qt_dep.qtver}', b
                yield b, b

        for b, name in gen_bins():
            if self.tools[name].found():
                continue

            if name == 'lrelease':
                arg = ['-version']
            elif version_compare(qt_dep.version, '>= 5'):
                arg = ['--version']
            else:
                arg = ['-v']

            # Ensure that the version of qt and each tool are the same
            def get_version(p: ExternalProgram) -> str:
                _, out, err = Popen_safe(p.get_command() + arg)
                if b.startswith('lrelease') or not qt_dep.version.startswith('4'):
                    care = out
                else:
                    care = err
                return care.split(' ')[-1].replace(')', '').strip()

            p = state.find_program(b, required=False,
                                   version_func=get_version,
                                   wanted=wanted)
            if p.found():
                self.tools[name] = p
def compilers_detect ( self , state : 'ModuleState' , qt_dep : 'QtDependencyType' ) -> None : # It is important that this list does not change order as the order of # the returned ExternalPrograms will change as well wanted = f'== {qt_dep.version}' def gen_bins ( ) -> T . Generator [ T . Tuple [ str , str ] , None , None ] : for b in self . tools : if qt_dep . bindir : yield os . path . join ( qt_dep . bindir , b ) , b # prefer the <tool>-qt<version> of the tool to the plain one, as we # don't know what the unsuffixed one points to without calling it. yield f'{b}-qt{qt_dep.qtver}' , b yield b , b for b , name in gen_bins ( ) : if self . tools [ name ] . found ( ) : continue if name == 'lrelease' : arg = [ '-version' ] elif version_compare ( qt_dep . version , '>= 5' ) : arg = [ '--version' ] else : arg = [ '-v' ] # Ensure that the version of qt and each tool are the same def get_version ( p : ExternalProgram ) -> str : _ , out , err = Popen_safe ( p . get_command ( ) + arg ) if b . startswith ( 'lrelease' ) or not qt_dep . version . startswith ( '4' ) : care = out else : care = err return care . split ( ' ' ) [ - 1 ] . replace ( ')' , '' ) . strip ( ) p = state . find_program ( b , required = False , version_func = get_version , wanted = wanted ) if p . found ( ) : self . tools [ name ] = p