def run(self):
     """Démarre le thread d'écoute du log openzwave."""
     self._pluginLog.info('Monitor openzwave manager is started.')
     self.running = True
     ozwTail = Tailer(open(self.ozwlogfile,  'rb'))
     for line in ozwTail.follow(delay=0.01):
         if line : self.cb_logNode(line)
         if self._stop.isSet() or not self.running : break
     self.running = False
     self._pluginLog.info('Monitor openzwave manager is stopped.')
示例#2
0
    def _devenv_compile(options, solution, version):
        proj_extension = MsvcCompiler._get_project_file_ext(version)
        devenv = MsvcCompiler._get_devenv_path(version)
        compiler_version = MsvcCompiler._get_compiler_version(
            version, options.build_platform)

        project = os.path.normpath(
            os.path.join(options.build_dir, 'ALL_BUILD' + proj_extension))
        solutionConfig = '%s|%s' % (options.build_config.capitalize(),
                                    options.build_platform)

        if options.verbose:
            print('Compiler       : %s' % compiler_version)
            print('Compile type   : %s' % options.compile_type)
            print('Devenv         : %s' % devenv)
            print('Solution       : %s' % solution)
            print('Project        : %s' % project)
            print('Solution Config: %s' % solutionConfig)
            print('Configuration  : %s' % options.build_config)
            print('Platform       : %s' % options.build_platform)

        with TempDir() as temp_dir:
            output = MsvcCompiler._create_log_filename(temp_dir.path,
                                                       options.compile_type,
                                                       options.build_config)

            command = 'devenv.exe "%s" /%s "%s" /project "%s" /projectconfig %s /out "%s"' % \
                      (solution, options.compile_type.capitalize(), \
                       solutionConfig, project, \
                       options.build_config.capitalize(), output)

            if options.verbose:
                print('Command: %s' % command)

            process = subprocess.Popen(command, \
                                       stdout=subprocess.PIPE, stderr=subprocess.STDOUT, \
                                       shell=True, bufsize=1, cwd=os.path.dirname(devenv))

            # Wait a max of 10secs to see if the output file will open
            total_time = 0.0
            while not os.path.isfile(output) and total_time < 10.0:
                total_time += .5
                time.sleep(total_time)

            # Tail the output from the log file to the console
            with open(output) as build_output:
                tailer = Tailer(build_output)
                for line in tailer.follow(terminate=process.poll):
                    print(line)
                    if process.poll() != None:
                        break

        return process.returncode
示例#3
0
    def _devenv_compile(options, solution, version):
        proj_extension = MsvcCompiler._get_project_file_ext(version)
        devenv = MsvcCompiler._get_devenv_path(version)
        compiler_version = MsvcCompiler._get_compiler_version(version, options.build_platform)

        project = os.path.normpath(os.path.join(options.build_dir, 'ALL_BUILD' + proj_extension))
        solutionConfig = '%s|%s' % (options.build_config.capitalize(), options.build_platform)

        if options.verbose:
            print('Compiler       : %s' % compiler_version)
            print('Compile type   : %s' % options.compile_type)
            print('Devenv         : %s' % devenv)
            print('Solution       : %s' % solution)
            print('Project        : %s' % project)
            print('Solution Config: %s' % solutionConfig)
            print('Configuration  : %s' % options.build_config)
            print('Platform       : %s' % options.build_platform)

        with TempDir() as temp_dir:
            output = MsvcCompiler._create_log_filename(temp_dir.path, options.compile_type, options.build_config)
            
            command = 'devenv.exe "%s" /%s "%s" /project "%s" /projectconfig %s /out "%s"' % \
                      (solution, options.compile_type.capitalize(), \
                       solutionConfig, project, \
                       options.build_config.capitalize(), output)

            if options.verbose:
                print('Command: %s' % command)

            process = subprocess.Popen(command, \
                                       stdout=subprocess.PIPE, stderr=subprocess.STDOUT, \
                                       shell=True, bufsize=1, cwd=os.path.dirname(devenv))

            # Wait a max of 10secs to see if the output file will open
            total_time = 0.0
            while not os.path.isfile(output) and total_time < 10.0:
                total_time += .5
                time.sleep(total_time)

            # Tail the output from the log file to the console
            with open(output) as build_output:
                tailer = Tailer(build_output)
                for line in tailer.follow(terminate=process.poll):
                    print(line)
                    if process.poll() != None:
                        break

        return process.returncode
示例#4
0
 def __init__(self, asynctailer, delay):
     filename = asynctailer.file.name
     super().__init__(name=f'Tailer->FollowThread [file={filename}]')
     self.queue = janus.Queue()
     self.asynctailer = asynctailer
     self.follow_generator = PyTailer.follow(self.asynctailer, delay=delay)