"""

  Utilities


"""
import subprocess
from os.path import isfile

import bgl

def run_python(args):
  """
  Run a python script.

  """
  # find a python executable
  python_executable = join(PYTHON_HOME, "python.exe")
  if not exists(python_executable):
    python_executable = join(PYTHON_HOME, "python")    
  return subprocess.call(python_executable, *args)


# add commas to long numbers to make them readable
def commify(num):
  return "{:,}".format(num)


def run_scons(args):
  """
  Run Scons in its own process, waits for it to complete.
  Returns an exit code.

  """
  return python(SCONS_HOME, *args)


def run_7zip(args):
  return subprocess.call(SEVEN_ZIP, *args)
