code: def conda_build(
      ts_wheel_path,
      ma_wheel_path,
      wa_wheel_path,
      conda_nightly=False,
      dry_run=False,
  ):
      """
      Build conda packages for different python versions
      """
  
      print(
          "## Started torchserve, model-archiver and workflow-archiver conda build"
      )
      print(f"## Using torchserve wheel: {ts_wheel_path}")
      print(f"## Using model archiver wheel: {ma_wheel_path}")
      print(f"## Using workflow archiver wheel: {wa_wheel_path}")
  
      with open(os.path.join(REPO_ROOT, "ts", "version.txt")) as ts_vf:
          ts_version = "".join(ts_vf.read().split())
      with open(
          os.path.join(
              REPO_ROOT,
              "model-archiver",
              "model_archiver",
              "version.txt",
          )
      ) as ma_vf:
          ma_version = "".join(ma_vf.read().split())
      with open(
          os.path.join(
              REPO_ROOT,
              "workflow-archiver",
              "workflow_archiver",
              "version.txt",
          )
      ) as wa_vf:
          wa_version = "".join(wa_vf.read().split())
  
      if conda_nightly:
          ts_version, ma_version, wa_version = [
              add_nightly_suffix_conda(binary_name)
              for binary_name in [ts_version, ma_version, wa_version]
          ]
  
      os.environ["TORCHSERVE_VERSION"] = ts_version
      os.environ["TORCH_MODEL_ARCHIVER_VERSION"] = ma_version
      os.environ["TORCH_WORKFLOW_ARCHIVER_VERSION"] = wa_version
  
      os.environ["TORCHSERVE_ROOT_DIR"] = REPO_ROOT.replace("\\", "/")
  
      os.environ["PYTHON"] = "python"
  
      python_versions = ["3.8", "3.9", "3.10", "3.11"]
      packages = [
          os.path.join(conda_build_dir, pkg) for pkg in PACKAGES
      ]
  
      # Generate conda binaries for linux-64
      for pkg in packages:
          for pyv in python_versions:
              output_dir = os.path.join(conda_build_dir, "output")
              cmd = f"{CONDA_BINARY} build --output-folder {output_dir} --python={pyv} {pkg}"
              print(
                  f"## In directory: {os.getcwd()}; Executing command: {cmd}"
              )
              try_and_handle(cmd, dry_run)
  
      # Generate conda binaries for other platforms
      for file in os.listdir(CONDA_LINUX_PACKAGES_PATH):
          file_path = os.path.join(CONDA_LINUX_PACKAGES_PATH, file)
          # Identify *.tar.bz2 files to convert
          if any(
              package_name in file_path for package_name in PACKAGES
          ) and file_path.endswith("tar.bz2"):
              for platform in PLATFORMS:
                  # Skip linux-64 since it already exists
                  if platform == "linux-64":
                      continue
                  cmd = f"{CONDA_BINARY} convert {file_path} -p {platform} -o {CONDA_PACKAGES_PATH}"
                  print(
                      f"## In directory: {os.getcwd()}; Executing command: {cmd}"
                  )
                  try_and_handle(cmd, dry_run)
  
      return 0
  
file_path: serve/binaries/conda/build_packages.py
imports: import argparse
  import os
  from datetime import date
  from ts_scripts.utils import try_and_handle
label_desc: Use image node_id 4 for calling a global function with example usage: conda_build(ts_wheel_path, ma_wheel_path, wa_wheel_path, conda_nightly, dry_run) and returns: int