# Path: Cython/Utils.py
# def replace_suffix(path, newsuf):
# def open_new_file(path):
# def castrate_file(path, st):
# def file_newer_than(path, time):
# def path_exists(path):
# def decode_filename(filename):
# def detect_file_encoding(source_filename):
#   def __init__(self, stream):
#   def read(self, count=-1):
#   def readlines(self):
# def open_source_file(source_filename, mode="r",
#                      encoding=None, error_handling=None,
#                      require_normalised_newlines=True):
# def open_source_from_loader(loader,
#                             source_filename,
#                             encoding=None, error_handling=None,
#                             require_normalised_newlines=True):
# def str_to_number(value):
# def long_literal(value):
#     def all(items):
#     def any(items):
# class NormalisedNewlineStream(object):
# 
# Path: Cython/Compiler/Main.py
# class CompilationData(object):
# class Context(object):
# class CompilationSource(object):
# class CompilationOptions(object):
# class CompilationResult(object):
# class CompilationResultSet(dict):
#     def __init__(self, include_directories, compiler_directives, cpp=False,
#                  language_level=2, options=None, create_testscope=True):
#     def set_language_level(self, level):
#     def process_pxd(self, source_desc, scope, module_name):
#     def nonfatal_error(self, exc):
#     def find_module(self, module_name,
#             relative_to = None, pos = None, need_pxd = 1, check_module_name = True):
#     def find_pxd_file(self, qualified_name, pos):
#     def find_pyx_file(self, qualified_name, pos):
#     def find_include_file(self, filename, pos):
#     def search_include_directories(self, qualified_name, suffix, pos,
#                                    include=False, sys_path=False):
#     def find_root_package_dir(self, file_path):
#     def check_package_dir(self, dir, package_names):
#     def c_file_out_of_date(self, source_path):
#     def find_cimported_module_names(self, source_path):
#     def is_package_dir(self, dir_path):
#     def read_dependency_file(self, source_path):
#     def lookup_submodule(self, name):
#     def find_submodule(self, name):
#     def parse(self, source_desc, scope, pxd, full_module_name):
#     def extract_module_name(self, path, options):
#     def setup_errors(self, options, result):
#     def teardown_errors(self, err, options, result):
# def create_default_resultobj(compilation_source, options):
# def run_pipeline(source, options, full_module_name = None):
#     def __init__(self, source_desc, full_module_name, cwd):
#     def __init__(self, defaults = None, **kw):
#     def create_context(self):
#     def __init__(self):
#     def add(self, source, result):
# def compile_single(source, options, full_module_name = None):
# def compile_multiple(sources, options):
# def compile(source, options = None, full_module_name = None, **kwds):
# def setuptools_main():
# def main(command_line = 0):


from glob import glob
from distutils.extension import Extension
from Cython import Utils
from Cython.Compiler.Main import Context, CompilationOptions, default_options
    from Cython.Compiler.Main import compile, default_options
    from Cython.Compiler.Errors import CompileError, PyrexError
import re, os, sys
            import multiprocessing
                    if not quiet:
                        if source == dep:
                            print("Compiling %s because it changed." % source)
                        else:
                            print("Compiling %s because it depends on %s." % (source, dep))
                    to_compile.append((priority, source, c_file, options))
                new_sources.append(c_file)
            else:
                new_sources.append(source)
        m.sources = new_sources
    to_compile.sort()
    if nthreads:
        # Requires multiprocessing (or Python >= 2.6)
        try:
            pool = multiprocessing.Pool(nthreads)
            pool.map(cythonize_one_helper, to_compile)
        except ImportError:
            print("multiprocessing required for parallel cythonization")
            nthreads = 0
    if not nthreads:
        for priority, pyx_file, c_file, options in to_compile:
            cythonize_one(pyx_file, c_file, quiet, options)
    return module_list

# TODO: Share context? Issue: pyx processing leaks into pxd module
def cythonize_one(pyx_file, c_file, quiet, options=None):

    if not quiet:
        print "Cythonizing %s" % pyx_file
    if options is None:

# Path: Cython/Utils.py
# def replace_suffix(path, newsuf):
# def open_new_file(path):
# def castrate_file(path, st):
# def file_newer_than(path, time):
# def path_exists(path):
# def decode_filename(filename):
# def detect_file_encoding(source_filename):
#   def __init__(self, stream):
#   def read(self, count=-1):
#   def readlines(self):
# def open_source_file(source_filename, mode="r",
#                      encoding=None, error_handling=None,
#                      require_normalised_newlines=True):
# def open_source_from_loader(loader,
#                             source_filename,
#                             encoding=None, error_handling=None,
#                             require_normalised_newlines=True):
# def str_to_number(value):
# def long_literal(value):
#     def all(items):
#     def any(items):
# class NormalisedNewlineStream(object):
# 
# Path: Cython/Compiler/Main.py
# class CompilationData(object):
# class Context(object):
# class CompilationSource(object):
# class CompilationOptions(object):
# class CompilationResult(object):
# class CompilationResultSet(dict):
#     def __init__(self, include_directories, compiler_directives, cpp=False,
#                  language_level=2, options=None, create_testscope=True):
#     def set_language_level(self, level):
#     def process_pxd(self, source_desc, scope, module_name):
#     def nonfatal_error(self, exc):
#     def find_module(self, module_name,
#             relative_to = None, pos = None, need_pxd = 1, check_module_name = True):
#     def find_pxd_file(self, qualified_name, pos):
#     def find_pyx_file(self, qualified_name, pos):
#     def find_include_file(self, filename, pos):
#     def search_include_directories(self, qualified_name, suffix, pos,
#                                    include=False, sys_path=False):
#     def find_root_package_dir(self, file_path):
#     def check_package_dir(self, dir, package_names):
#     def c_file_out_of_date(self, source_path):
#     def find_cimported_module_names(self, source_path):
#     def is_package_dir(self, dir_path):
#     def read_dependency_file(self, source_path):
#     def lookup_submodule(self, name):
#     def find_submodule(self, name):
#     def parse(self, source_desc, scope, pxd, full_module_name):
#     def extract_module_name(self, path, options):
#     def setup_errors(self, options, result):
#     def teardown_errors(self, err, options, result):
# def create_default_resultobj(compilation_source, options):
# def run_pipeline(source, options, full_module_name = None):
#     def __init__(self, source_desc, full_module_name, cwd):
#     def __init__(self, defaults = None, **kw):
#     def create_context(self):
#     def __init__(self):
#     def add(self, source, result):
# def compile_single(source, options, full_module_name = None):
# def compile_multiple(sources, options):
# def compile(source, options = None, full_module_name = None, **kwds):
# def setuptools_main():
# def main(command_line = 0):


# Path: Cython/Build/Dependencies.py
from glob import glob
from distutils.extension import Extension
from Cython import Utils
from Cython.Compiler.Main import Context, CompilationOptions, default_options
    from Cython.Compiler.Main import compile, default_options
    from Cython.Compiler.Errors import CompileError, PyrexError
import re, os, sys
            import multiprocessing

                    if not quiet:
                        if source == dep:
                            print("Compiling %s because it changed." % source)
                        else:
                            print("Compiling %s because it depends on %s." % (source, dep))
                    to_compile.append((priority, source, c_file, options))
                new_sources.append(c_file)
            else:
                new_sources.append(source)
        m.sources = new_sources
    to_compile.sort()
    if nthreads:
        # Requires multiprocessing (or Python >= 2.6)
        try:
            pool = multiprocessing.Pool(nthreads)
            pool.map(cythonize_one_helper, to_compile)
        except ImportError:
            print("multiprocessing required for parallel cythonization")
            nthreads = 0
    if not nthreads:
        for priority, pyx_file, c_file, options in to_compile:
            cythonize_one(pyx_file, c_file, quiet, options)
    return module_list

# TODO: Share context? Issue: pyx processing leaks into pxd module
def cythonize_one(pyx_file, c_file, quiet, options=None):

    if not quiet:
        print "Cythonizing %s" % pyx_file
    if options is None:

        options = CompilationOptions(default_options)