def start(self, **kwargs):
    extra_args = kwargs.pop("extra_args", [])

    # Figure out whether the various GL libraries exist since SC2 sometimes
    # fails if you ask to use a library that doesn't exist.
    libs = subprocess.check_output(["/sbin/ldconfig", "-p"]).decode()
    libs = {lib.strip().split()[0] for lib in libs.split("\n") if lib}
    if "libEGL.so" in libs:  # Prefer hardware rendering.
      extra_args += ["-eglpath", "libEGL.so"]
    else:
      for mesa_lib in self.known_mesa:  # Look for a software renderer.
        if mesa_lib in libs:
          extra_args += ["-osmesapath", mesa_lib]
          break
      else:
        logging.info("No GL library found, so RGB rendering will be disabled. "
                     "For software rendering install libosmesa.")

    return super(Linux, self).start(extra_args=extra_args, **kwargs)
示例#2
0
    def start(self, want_rgb=True, **kwargs):
        extra_args = kwargs.pop("extra_args", [])

        if want_rgb:
            # Figure out whether the various GL libraries exist since SC2 sometimes
            # fails if you ask to use a library that doesn't exist.
            libs = subprocess.check_output(["/sbin/ldconfig", "-p"]).decode()
            libs = {lib.strip().split()[0] for lib in libs.split("\n") if lib}
            for arg, lib_name in self.known_gl_libs:
                if lib_name in libs:
                    extra_args += [arg, lib_name]
                    break
            else:
                extra_args += ["-headlessNoRender"]
                logging.info(
                    "No GL library found, so RGB rendering will be disabled. "
                    "For software rendering install libosmesa.")

        return super(Linux, self).start(want_rgb=want_rgb,
                                        extra_args=extra_args,
                                        **kwargs)