(self, cmd: List[str], check_output: bool = True)
return stdout
Executes tool set-up or check within its virtual environment
Executes tool set-up or check within its virtual environment
Executes tool set - up or check within its virtual environment
def venv_exec(self, cmd: List[str], check_output: bool = True) -> str:
        """
        Executes tool set-up or check within its virtual environment
        """
        logging.debug(f"{self.tool_id()}: Running '{cmd}'")
        before = time()
        env = dict(os.environ)
        env["VIRTUAL_ENV"] = str(self.venv_dir())
        env["PATH"] = f"{self.venv_dir()}:{self.venv_dir()}/bin:" + env["PATH"]
        if "PYTHONHOME" in env:
            del env["PYTHONHOME"]
        v = subprocess.Popen(
            cmd,
            cwd=str(self.base_path),
            encoding="utf8",
            env=env,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
        )
        stdout, stderr = v.communicate()
        after = time()
        logging.debug(f"{self.tool_id()}: Command completed in {after - before:2f} s")
        logging.debug(f"{self.tool_id()}: stderr[:4000]:\n" + stderr[0:4000])
        logging.debug(f"{self.tool_id()}: stdout[:4000]:\n" + stdout[0:4000])
        if check_output and v.returncode != 0:
            raise subprocess.CalledProcessError(
                v.returncode, cmd, output=stdout, stderr=stderr
            )
        return stdout
def venv_exec ( self , cmd : List [ str ] , check_output : bool = True ) -> str : logging . debug ( f"{self.tool_id()}: Running '{cmd}'" ) before = time ( ) env = dict ( os . environ ) env [ "VIRTUAL_ENV" ] = str ( self . venv_dir ( ) ) env [ "PATH" ] = f"{self.venv_dir()}:{self.venv_dir()}/bin:" + env [ "PATH" ] if "PYTHONHOME" in env : del env [ "PYTHONHOME" ] v = subprocess . Popen ( cmd , cwd = str ( self . base_path ) , encoding = "utf8" , env = env , stdout = subprocess . PIPE , stderr = subprocess . PIPE , ) stdout , stderr = v . communicate ( ) after = time ( ) logging . debug ( f"{self.tool_id()}: Command completed in {after - before:2f} s" ) logging . debug ( f"{self.tool_id()}: stderr[:4000]:\n" + stderr [ 0 : 4000 ] ) logging . debug ( f"{self.tool_id()}: stdout[:4000]:\n" + stdout [ 0 : 4000 ] ) if check_output and v . returncode != 0 : raise subprocess . CalledProcessError ( v . returncode , cmd , output = stdout , stderr = stderr ) return stdout