code: def cython_compile(path_pattern, options):
      pool = None
      all_paths = map(os.path.abspath, extended_iglob(path_pattern))
      try:
          for path in all_paths:
              if options.build_inplace:
                  base_dir = path
                  while not os.path.isdir(base_dir) or is_package_dir(
                      base_dir
                  ):
                      base_dir = os.path.dirname(base_dir)
              else:
                  base_dir = None
  
              if os.path.isdir(path):
                  # recursively compiling a package
                  paths = [os.path.join(path, "**", "*.{py,pyx}")]
              else:
                  # assume it's a file(-like thing)
                  paths = [path]
  
              ext_modules = cythonize(
                  paths,
                  nthreads=options.parallel,
                  exclude_failures=options.keep_going,
                  exclude=options.excludes,
                  compiler_directives=options.directives,
                  compile_time_env=options.compile_time_env,
                  force=options.force,
                  quiet=options.quiet,
                  depfile=options.depfile,
                  **options.options,
              )
  
              if ext_modules and options.build:
                  if len(ext_modules) > 1 and options.parallel > 1:
                      if pool is None:
                          try:
                              pool = multiprocessing.Pool(
                                  options.parallel
                              )
                          except OSError:
                              pool = _FakePool()
                      pool.map_async(
                          run_distutils,
                          [(base_dir, [ext]) for ext in ext_modules],
                      )
                  else:
                      run_distutils((base_dir, ext_modules))
      except:
          if pool is not None:
              pool.terminate()
          raise
      else:
          if pool is not None:
              pool.close()
              pool.join()
  
imports: from __future__ import absolute_import
  import os
  import shutil
  import tempfile
  from distutils.core import setup
  from .Dependencies import cythonize, extended_iglob
  from ..Utils import is_package_dir
  from ..Compiler import Options
label_desc: Use image node_id 5 for calling a global function with example usage: cython_compile(path_pattern, options) without return types