def scanQmlImports(self):
     qmlImportCommandFile = os.path.join(self.qtRootPath,
                                         'bin/qmlimportscanner')
     system = platform.system()
     if 'Windows' == system:
         qmlImportCommandFile += ".exe"
     if not os.path.isfile(qmlImportCommandFile):
         raise RuntimeError("Couldn't find qml import scanner")
     qmlRootPath = hifi_utils.scriptRelative('interface/resources/qml')
     qmlImportPath = os.path.join(self.qtRootPath, 'qml')
     commandResult = hifi_utils.executeSubprocessCapture([
         qmlImportCommandFile, '-rootPath', qmlRootPath, '-importPath',
         qmlImportPath
     ])
     qmlImportResults = json.loads(commandResult)
     for item in qmlImportResults:
         if 'path' not in item:
             continue
         path = os.path.realpath(item['path'])
         if not os.path.exists(path):
             continue
         basePath = path
         if os.path.isfile(basePath):
             basePath = os.path.dirname(basePath)
         basePath = os.path.normcase(basePath)
         if basePath.startswith(qmlRootPath):
             continue
         self.files.extend(
             hifi_utils.recursiveFileList(path, excludeNamePattern=r"^\."))
Beispiel #2
0
 def scanQmlImports(self):
     qmlImportCommandFile = os.path.join(self.qtRootPath, 'bin/qmlimportscanner')
     system = platform.system()
     if 'Windows' == system:
         qmlImportCommandFile += ".exe"
     if not os.path.isfile(qmlImportCommandFile):
         raise RuntimeError("Couldn't find qml import scanner")
     qmlRootPath = hifi_utils.scriptRelative('interface/resources/qml')
     qmlImportPath = os.path.join(self.qtRootPath, 'qml')
     commandResult = hifi_utils.executeSubprocessCapture([
         qmlImportCommandFile, 
         '-rootPath', qmlRootPath, 
         '-importPath', qmlImportPath
     ])
     qmlImportResults = json.loads(commandResult)
     for item in qmlImportResults:
         if 'path' not in item:
             print("Warning: QML import could not be resolved in any of the import paths: {}".format(item['name']))
             continue
         path = os.path.realpath(item['path'])
         if not os.path.exists(path):
             continue
         basePath = path
         if os.path.isfile(basePath):
             basePath = os.path.dirname(basePath)
         basePath = os.path.normcase(basePath)
         if basePath.startswith(qmlRootPath):
             continue
         self.files.extend(hifi_utils.recursiveFileList(path))