waf

FORK: waf with some random patches
git clone https://git.neptards.moe/neptards/waf.git
Log | Files | Refs | README

qtchainer.py (1332B)


      1 #!/usr/bin/env python
      2 # encoding: utf-8
      3 # Federico Pellegrin, 2016 (fedepell)
      4 
      5 #
      6 # Example extra that chains to either qt5 or pyqt5 for QRC/UI files as
      7 # just one handler for an extension can be natively defined. The extra
      8 # has to be loaded after qt5 and pyqt5 and files need to have explicitly
      9 # set the feature they want to use.
     10 #
     11 
     12 import os
     13 from waflib.Tools import python
     14 from waflib.Tools import cxx
     15 from waflib.extras import pyqt5
     16 from waflib.Tools import qt5
     17 from waflib import Task
     18 from waflib.TaskGen import extension
     19 from waflib import Logs
     20 
     21 
     22 EXT_RCC = ['.qrc']
     23 """
     24 File extension for the resource (.qrc) files
     25 """
     26 
     27 EXT_UI  = ['.ui']
     28 """
     29 File extension for the user interface (.ui) files
     30 """
     31 
     32 
     33 @extension(*EXT_RCC)
     34 def create_chain_task(self, node):
     35 	"Creates rcc and py task for ``.qrc`` files"
     36 	if 'qt5' in self.features:
     37 		qt5.create_rcc_task(self, node)
     38 	elif 'pyqt5' in self.features:
     39 		pyqt5.create_pyrcc_task(self, node)
     40 	else:
     41 		Logs.warn("No feature explicitly defined for '%s'",node)
     42 
     43 
     44 @extension(*EXT_UI)
     45 def create_chain_task(self, node):
     46 	"Create uic tasks and py for user interface ``.ui`` definition files"
     47 	if 'qt5' in self.features:
     48 		qt5.create_uic_task(self, node)
     49 	elif 'pyqt5' in self.features:
     50 		pyqt5.create_pyuic_task(self, node)
     51 	else:
     52 		Logs.warn("No feature explicitly defined for '%s'",node)
     53