parameters: (download, verbose)
return_statement: return cmake_local_exe
docstring: Return the path to system CMake, or download and unpack a local copy.
docstring_summary: Return the path to system CMake, or download and unpack a local copy.
docstring_tokens: Return the path to system CMake or download and unpack a local copy .
function: def get_cmake(download, verbose):
      """Return the path to system CMake, or download and unpack a local copy."""
      if not download:
          cmake = shutil.which('cmake')
          if cmake:
              if verbose:
                  print(f'Found CMake at {cmake}')
              return cmake
  
      plat = {
          'darwin': 'Darwin',
          'linux': 'Linux',
          'win32': 'win64'}[
          sys.platform]
      cmake_prefix = f'cmake-3.15.7-{plat}-x86_64'
      cmake_local_dir = SCRIPT_PATH / 'external' / 'cmake'
      cmake_file = f'{cmake_prefix}.tar.gz'
      cmake_local_tgz = cmake_local_dir / cmake_file
      cmake_local_exe = cmake_local_dir / cmake_prefix / \
          ('CMake.app/Contents' if sys.platform == 'darwin' else '') / 'bin' / 'cmake'
  
      if not cmake_local_exe.exists():
          if not cmake_local_tgz.exists():
              cmake_local_dir.mkdir(parents=True, exist_ok=True)
              download_file(
                  CMAKE_URL.format(cmake_file),
                  cmake_local_tgz,
                  verbose)
          with tarfile.open(cmake_local_tgz, 'r') as tar:
              tar.extractall(path=cmake_local_dir)
  
      return cmake_local_exe
function_tokens: def get_cmake ( download , verbose ) : if not download : cmake = shutil . which ( 'cmake' ) if cmake : if verbose : print ( f'Found CMake at {cmake}' ) return cmake plat = { 'darwin' : 'Darwin' , 'linux' : 'Linux' , 'win32' : 'win64' } [ sys . platform ] cmake_prefix = f'cmake-3.15.7-{plat}-x86_64' cmake_local_dir = SCRIPT_PATH / 'external' / 'cmake' cmake_file = f'{cmake_prefix}.tar.gz' cmake_local_tgz = cmake_local_dir / cmake_file cmake_local_exe = cmake_local_dir / cmake_prefix / ( 'CMake.app/Contents' if sys . platform == 'darwin' else '' ) / 'bin' / 'cmake' if not cmake_local_exe . exists ( ) : if not cmake_local_tgz . exists ( ) : cmake_local_dir . mkdir ( parents = True , exist_ok = True ) download_file ( CMAKE_URL . format ( cmake_file ) , cmake_local_tgz , verbose ) with tarfile . open ( cmake_local_tgz , 'r' ) as tar : tar . extractall ( path = cmake_local_dir ) return cmake_local_exe