class_docstr: Generate MediaPipe Python protobuf files by Protocol Compiler.
class_docstr_tok: ["Generate","MediaPipe","Python","protobuf","files","by","Protocol","Compiler","."]
code: def run(self):
      if "PROTOC" in os.environ and os.path.exists(
          os.environ["PROTOC"]
      ):
          self._protoc = os.environ["PROTOC"]
      else:
          self._protoc = shutil.which("protoc")
      if self._protoc is None:
          sys.stderr.write(
              "protoc is not found. Please run 'apt install -y protobuf"
              "-compiler' (linux) or 'brew install protobuf'(macos) to install "
              "protobuf compiler binary."
          )
          sys.exit(-1)
  
      # Add __init__.py to mediapipe proto directories to make the py protos
      # indexable.
      proto_dirs = (
          ["mediapipe/calculators"]
          + [x[0] for x in os.walk("mediapipe/modules")]
          + [x[0] for x in os.walk("mediapipe/tasks/cc")]
      )
      for proto_dir in proto_dirs:
          self._add_empty_init_file(
              os.path.abspath(
                  os.path.join(
                      MP_ROOT_PATH,
                      self.build_lib,
                      proto_dir,
                      "__init__.py",
                  )
              )
          )
  
      # Build framework and calculator py protos.
      for pattern in [
          "mediapipe/framework/**/*.proto",
          "mediapipe/calculators/**/*.proto",
          "mediapipe/gpu/**/*.proto",
          "mediapipe/modules/**/*.proto",
          "mediapipe/tasks/cc/**/*.proto",
          "mediapipe/util/**/*.proto",
      ]:
          for proto_file in glob.glob(pattern, recursive=True):
              # Ignore test protos.
              if proto_file.endswith("test.proto"):
                  continue
              # Ignore tensorflow protos in mediapipe/calculators/tensorflow.
              if "tensorflow" in proto_file:
                  continue
              # Ignore testdata dir.
              if "testdata" in proto_file:
                  continue
              self._add_empty_init_file(
                  os.path.abspath(
                      os.path.join(
                          MP_ROOT_PATH,
                          self.build_lib,
                          os.path.dirname(proto_file),
                          "__init__.py",
                      )
                  )
              )
              self._generate_proto(proto_file)
  
imports: import glob
  import os
  import platform
  import posixpath
  import re
  import shlex
  import shutil
  import subprocess
  import sys
  import setuptools
  from setuptools.command import build_ext
  from setuptools.command import build_py
  from setuptools.command import install
label_desc: Use image node_id 1 for calling the GeneratePyProtos obj's underlying member method code with example usage: obj.run() without return types