Ejemplo n.º 1
0
def ext_modules(static_include_dirs, static_library_dirs,
                static_cflags, static_binaries): 
    global XML2_CONFIG, XSLT_CONFIG
    if OPTION_BUILD_LIBXML2XSLT:
        from buildlibxml import build_libxml2xslt
        XML2_CONFIG, XSLT_CONFIG = build_libxml2xslt(
            'libs', 'build/tmp',
            static_include_dirs, static_library_dirs,
            static_cflags, static_binaries,
            libxml2_version=OPTION_LIBXML2_VERSION,
            libxslt_version=OPTION_LIBXSLT_VERSION)
    if CYTHON_INSTALLED:
        source_extension = ".pyx"
        print("Building with Cython %s." % Cython.Compiler.Version.version)
    else:
        print ("NOTE: Trying to build without Cython, pre-generated "
               "'%slxml.etree.c' needs to be available." % PACKAGE_PATH)
        source_extension = ".c"

    if OPTION_WITHOUT_OBJECTIFY:
        modules = [ entry for entry in EXT_MODULES
                    if 'objectify' not in entry ]
    else:
        modules = EXT_MODULES

    lib_versions = get_library_versions()
    if lib_versions[0]:
        print("Using build configuration of libxml2 %s and libxslt %s" % 
              lib_versions)
    else:
        print("Using build configuration of libxslt %s" % 
              lib_versions[1])

    _include_dirs = include_dirs(static_include_dirs)
    _library_dirs = library_dirs(static_library_dirs)
    _cflags = cflags(static_cflags)
    _define_macros = define_macros()
    _libraries = libraries()

    if _library_dirs:
        message = "Building against libxml2/libxslt in "
        if len(_library_dirs) > 1:
            print(message + "one of the following directories:")
            for dir in _library_dirs:
                print("  " + dir)
        else:
            print(message + "the following directory: " +
                  _library_dirs[0])

    if OPTION_AUTO_RPATH:
        runtime_library_dirs = _library_dirs
    else:
        runtime_library_dirs = []

    if not OPTION_SHOW_WARNINGS:
        _cflags = ['-w'] + _cflags

    result = []
    for module in modules:
        main_module_source = PACKAGE_PATH + module + source_extension
        dependencies = find_dependencies(module)
        result.append(
            Extension(
            module,
            sources = [main_module_source] + dependencies,
            extra_compile_args = _cflags,
            extra_objects = static_binaries,
            define_macros = _define_macros,
            include_dirs = _include_dirs,
            library_dirs = _library_dirs,
            runtime_library_dirs = runtime_library_dirs,
            libraries = _libraries,
            ))
    return result
Ejemplo n.º 2
0
def ext_modules(static_include_dirs, static_library_dirs,
                static_cflags, static_binaries): 
    global XML2_CONFIG, XSLT_CONFIG
    if OPTION_BUILD_LIBXML2XSLT:
        from buildlibxml import build_libxml2xslt, get_prebuilt_libxml2xslt
        if sys.platform.startswith('win'):
            get_prebuilt_libxml2xslt(
                OPTION_DOWNLOAD_DIR, static_include_dirs, static_library_dirs)
        else:
            XML2_CONFIG, XSLT_CONFIG = build_libxml2xslt(
                OPTION_DOWNLOAD_DIR, 'build/tmp',
                static_include_dirs, static_library_dirs,
                static_cflags, static_binaries,
                libiconv_version=OPTION_LIBICONV_VERSION,
                libxml2_version=OPTION_LIBXML2_VERSION,
                libxslt_version=OPTION_LIBXSLT_VERSION,
                multicore=OPTION_MULTICORE)

    if OPTION_WITHOUT_OBJECTIFY:
        modules = [ entry for entry in EXT_MODULES
                    if 'objectify' not in entry ]
    else:
        modules = EXT_MODULES

    c_files_exist = [ os.path.exists('%s%s.c' % (PACKAGE_PATH, module)) for module in modules ]

    if CYTHON_INSTALLED and (OPTION_WITH_CYTHON or False in c_files_exist):
        source_extension = ".pyx"
        print("Building with Cython %s." % Cython.Compiler.Version.version)
        # generate module cleanup code
        from Cython.Compiler import Options
        Options.generate_cleanup_code = 3
    elif not OPTION_WITHOUT_CYTHON and False in c_files_exist:
        for exists, module in zip(c_files_exist, modules):
            if not exists:
                raise RuntimeError(
                    "ERROR: Trying to build without Cython, but pre-generated '%s%s.c' "
                    "is not available (pass --without-cython to ignore this error)." % (
                        PACKAGE_PATH, module))
    else:
        if False in c_files_exist:
            for exists, module in zip(c_files_exist, modules):
                if not exists:
                    print("WARNING: Trying to build without Cython, but pre-generated "
                          "'%s%s.c' is not available." % (PACKAGE_PATH, module))
        source_extension = ".c"
        print("Building without Cython.")

    lib_versions = get_library_versions()
    if lib_versions[0]:
        print("Using build configuration of libxml2 %s and libxslt %s" % 
              lib_versions)
    else:
        print("Using build configuration of libxslt %s" % 
              lib_versions[1])

    _include_dirs = include_dirs(static_include_dirs)
    _library_dirs = library_dirs(static_library_dirs)
    _cflags = cflags(static_cflags)
    _define_macros = define_macros()
    _libraries = libraries()

    _include_dirs.append(os.path.join(get_base_dir(), INCLUDE_PACKAGE_PATH))

    if _library_dirs:
        message = "Building against libxml2/libxslt in "
        if len(_library_dirs) > 1:
            print(message + "one of the following directories:")
            for dir in _library_dirs:
                print("  " + dir)
        else:
            print(message + "the following directory: " +
                  _library_dirs[0])

    if OPTION_AUTO_RPATH:
        runtime_library_dirs = _library_dirs
    else:
        runtime_library_dirs = []

    if CYTHON_INSTALLED and OPTION_SHOW_WARNINGS:
        from Cython.Compiler import Errors
        Errors.LEVEL = 0

    result = []
    for module in modules:
        main_module_source = PACKAGE_PATH + module + source_extension
        result.append(
            Extension(
            module,
            sources = [main_module_source],
            depends = find_dependencies(module),
            extra_compile_args = _cflags,
            extra_objects = static_binaries,
            define_macros = _define_macros,
            include_dirs = _include_dirs,
            library_dirs = _library_dirs,
            runtime_library_dirs = runtime_library_dirs,
            libraries = _libraries,
            ))
    if CYTHON_INSTALLED and OPTION_WITH_CYTHON_GDB:
        for ext in result:
            ext.cython_gdb = True
    return result
Ejemplo n.º 3
0
def ext_modules(static_include_dirs, static_library_dirs,
                static_cflags, static_binaries): 
    global XML2_CONFIG, XSLT_CONFIG
    if OPTION_BUILD_LIBXML2XSLT:
        from buildlibxml import build_libxml2xslt, get_prebuilt_libxml2xslt
        if sys.platform.startswith('win'):
            get_prebuilt_libxml2xslt(
                OPTION_DOWNLOAD_DIR, static_include_dirs, static_library_dirs)
        else:
            XML2_CONFIG, XSLT_CONFIG = build_libxml2xslt(
                OPTION_DOWNLOAD_DIR, 'build/tmp',
                static_include_dirs, static_library_dirs,
                static_cflags, static_binaries,
                libiconv_version=OPTION_LIBICONV_VERSION,
                libxml2_version=OPTION_LIBXML2_VERSION,
                libxslt_version=OPTION_LIBXSLT_VERSION,
                multicore=OPTION_MULTICORE)

    if CYTHON_INSTALLED:
        source_extension = ".pyx"
        print("Building with Cython %s." % Cython.Compiler.Version.version)

        # generate module cleanup code for globals, but not for etree types imported in objectify
        from Cython.Compiler import Options
        Options.generate_cleanup_code = 2
    else:
        source_extension = ".c"
        if not os.path.exists(PACKAGE_PATH + 'lxml.etree.c'):
            print ("WARNING: Trying to build without Cython, but pre-generated "
                   "'%slxml.etree.c' does not seem to be available." % PACKAGE_PATH)
        else:
            print ("Building without Cython.")

    if OPTION_WITHOUT_OBJECTIFY:
        modules = [ entry for entry in EXT_MODULES
                    if 'objectify' not in entry ]
    else:
        modules = EXT_MODULES

    lib_versions = get_library_versions()
    if lib_versions[0]:
        print("Using build configuration of libxml2 %s and libxslt %s" % 
              lib_versions)
    else:
        print("Using build configuration of libxslt %s" % 
              lib_versions[1])

    _include_dirs = include_dirs(static_include_dirs)
    _library_dirs = library_dirs(static_library_dirs)
    _cflags = cflags(static_cflags)
    _define_macros = define_macros()
    _libraries = libraries()

    _include_dirs.append(os.path.join(get_base_dir(), INCLUDE_PACKAGE_PATH))

    if _library_dirs:
        message = "Building against libxml2/libxslt in "
        if len(_library_dirs) > 1:
            print(message + "one of the following directories:")
            for dir in _library_dirs:
                print("  " + dir)
        else:
            print(message + "the following directory: " +
                  _library_dirs[0])

    if OPTION_AUTO_RPATH:
        runtime_library_dirs = _library_dirs
    else:
        runtime_library_dirs = []

    if OPTION_SHOW_WARNINGS:
        if CYTHON_INSTALLED:
            from Cython.Compiler import Errors
            Errors.LEVEL = 0
    else:
        _cflags = ['-w'] + _cflags

    result = []
    for module in modules:
        main_module_source = PACKAGE_PATH + module + source_extension
        result.append(
            Extension(
            module,
            sources = [main_module_source],
            depends = find_dependencies(module),
            extra_compile_args = _cflags,
            extra_objects = static_binaries,
            define_macros = _define_macros,
            include_dirs = _include_dirs,
            library_dirs = _library_dirs,
            runtime_library_dirs = runtime_library_dirs,
            libraries = _libraries,
            ))
    return result
Ejemplo n.º 4
0
def ext_modules(static_include_dirs, static_library_dirs, static_cflags,
                static_binaries):
    global XML2_CONFIG, XSLT_CONFIG
    if OPTION_BUILD_LIBXML2XSLT:
        from buildlibxml import build_libxml2xslt, get_prebuilt_libxml2xslt
        if sys.platform.startswith('win'):
            get_prebuilt_libxml2xslt(OPTION_DOWNLOAD_DIR, static_include_dirs,
                                     static_library_dirs)
        else:
            XML2_CONFIG, XSLT_CONFIG = build_libxml2xslt(
                OPTION_DOWNLOAD_DIR,
                'build/tmp',
                static_include_dirs,
                static_library_dirs,
                static_cflags,
                static_binaries,
                libiconv_version=OPTION_LIBICONV_VERSION,
                libxml2_version=OPTION_LIBXML2_VERSION,
                libxslt_version=OPTION_LIBXSLT_VERSION,
                multicore=OPTION_MULTICORE)

    if CYTHON_INSTALLED:
        source_extension = ".pyx"
        print("Building with Cython %s." % Cython.Compiler.Version.version)

        # generate module cleanup code
        from Cython.Compiler import Options
        Options.generate_cleanup_code = 3
    else:
        source_extension = ".c"
        if not os.path.exists(PACKAGE_PATH + 'lxml.etree.c'):
            print("WARNING: Trying to build without Cython, but pre-generated "
                  "'%slxml.etree.c' does not seem to be available." %
                  PACKAGE_PATH)
        else:
            print("Building without Cython.")

    if OPTION_WITHOUT_OBJECTIFY:
        modules = [entry for entry in EXT_MODULES if 'objectify' not in entry]
    else:
        modules = EXT_MODULES

    lib_versions = get_library_versions()
    if lib_versions[0]:
        print("Using build configuration of libxml2 %s and libxslt %s" %
              lib_versions)
    else:
        print("Using build configuration of libxslt %s" % lib_versions[1])

    _include_dirs = include_dirs(static_include_dirs)
    _library_dirs = library_dirs(static_library_dirs)
    _cflags = cflags(static_cflags)
    _define_macros = define_macros()
    _libraries = libraries()

    _include_dirs.append(os.path.join(get_base_dir(), INCLUDE_PACKAGE_PATH))

    if _library_dirs:
        message = "Building against libxml2/libxslt in "
        if len(_library_dirs) > 1:
            print(message + "one of the following directories:")
            for dir in _library_dirs:
                print("  " + dir)
        else:
            print(message + "the following directory: " + _library_dirs[0])

    if OPTION_AUTO_RPATH:
        runtime_library_dirs = _library_dirs
    else:
        runtime_library_dirs = []

    if CYTHON_INSTALLED and OPTION_SHOW_WARNINGS:
        from Cython.Compiler import Errors
        Errors.LEVEL = 0

    result = []
    for module in modules:
        main_module_source = PACKAGE_PATH + module + source_extension
        result.append(
            Extension(
                module,
                sources=[main_module_source],
                depends=find_dependencies(module),
                extra_compile_args=_cflags,
                extra_objects=static_binaries,
                define_macros=_define_macros,
                include_dirs=_include_dirs,
                library_dirs=_library_dirs,
                runtime_library_dirs=runtime_library_dirs,
                libraries=_libraries,
            ))
    if CYTHON_INSTALLED and OPTION_WITH_CYTHON_GDB:
        for ext in result:
            ext.cython_gdb = True
    return result
Ejemplo n.º 5
0
def ext_modules(static_include_dirs, static_library_dirs, static_cflags,
                static_binaries):
    global XML2_CONFIG, XSLT_CONFIG
    if OPTION_BUILD_LIBXML2XSLT:
        from buildlibxml import build_libxml2xslt, get_prebuilt_libxml2xslt

        if sys.platform.startswith("win"):
            get_prebuilt_libxml2xslt(OPTION_DOWNLOAD_DIR, static_include_dirs,
                                     static_library_dirs)
        else:
            XML2_CONFIG, XSLT_CONFIG = build_libxml2xslt(
                OPTION_DOWNLOAD_DIR,
                "build/tmp",
                static_include_dirs,
                static_library_dirs,
                static_cflags,
                static_binaries,
                libiconv_version=OPTION_LIBICONV_VERSION,
                libxml2_version=OPTION_LIBXML2_VERSION,
                libxslt_version=OPTION_LIBXSLT_VERSION,
                zlib_version=OPTION_ZLIB_VERSION,
                multicore=OPTION_MULTICORE,
            )

    modules = EXT_MODULES + COMPILED_MODULES
    if OPTION_WITHOUT_OBJECTIFY:
        modules = [entry for entry in modules if "objectify" not in entry]

    module_files = list(
        os.path.join(SOURCE_PATH, *module.split(".")) for module in modules)
    c_files_exist = [os.path.exists(module + ".c") for module in module_files]

    use_cython = True
    if CYTHON_INSTALLED and (OPTION_WITH_CYTHON or not all(c_files_exist)):
        print("Building with Cython %s." % Cython.Compiler.Version.version)
        # generate module cleanup code
        from Cython.Compiler import Options

        Options.generate_cleanup_code = 3
        Options.clear_to_none = False
    elif not OPTION_WITHOUT_CYTHON and not all(c_files_exist):
        for exists, module in zip(c_files_exist, module_files):
            if not exists:
                raise RuntimeError(
                    "ERROR: Trying to build without Cython, but pre-generated '%s.c' "
                    "is not available (pass --without-cython to ignore this error)."
                    % module)
    else:
        if not all(c_files_exist):
            for exists, module in zip(c_files_exist, module_files):
                if not exists:
                    print(
                        "WARNING: Trying to build without Cython, but pre-generated "
                        "'%s.c' is not available." % module)
        use_cython = False
        print("Building without Cython.")

    if not check_build_dependencies():
        raise RuntimeError("Dependency missing")

    base_dir = get_base_dir()
    _include_dirs = _prefer_reldirs(
        base_dir,
        include_dirs(static_include_dirs) + [
            SOURCE_PATH,
            INCLUDE_PACKAGE_PATH,
        ],
    )
    _library_dirs = _prefer_reldirs(base_dir,
                                    library_dirs(static_library_dirs))
    _cflags = cflags(static_cflags)
    _ldflags = (["-isysroot", get_xcode_isysroot()]
                if sys.platform == "darwin" else None)
    _define_macros = define_macros()
    _libraries = libraries()

    if _library_dirs:
        message = "Building against libxml2/libxslt in "
        if len(_library_dirs) > 1:
            print(message + "one of the following directories:")
            for dir in _library_dirs:
                print("  " + dir)
        else:
            print(message + "the following directory: " + _library_dirs[0])

    if OPTION_AUTO_RPATH:
        runtime_library_dirs = _library_dirs
    else:
        runtime_library_dirs = []

    if CYTHON_INSTALLED and OPTION_SHOW_WARNINGS:
        from Cython.Compiler import Errors

        Errors.LEVEL = 0

    cythonize_directives = {
        "binding": True,
    }
    if OPTION_WITH_COVERAGE:
        cythonize_directives["linetrace"] = True

    result = []
    for module, src_file in zip(modules, module_files):
        is_py = module in COMPILED_MODULES
        main_module_source = src_file + (".c" if not use_cython else
                                         ".py" if is_py else ".pyx")
        result.append(
            Extension(
                module,
                sources=[main_module_source],
                depends=find_dependencies(module),
                extra_compile_args=_cflags,
                extra_link_args=None if is_py else _ldflags,
                extra_objects=None if is_py else static_binaries,
                define_macros=_define_macros,
                include_dirs=_include_dirs,
                library_dirs=None if is_py else _library_dirs,
                runtime_library_dirs=None if is_py else runtime_library_dirs,
                libraries=None if is_py else _libraries,
            ))
    if CYTHON_INSTALLED and OPTION_WITH_CYTHON_GDB:
        for ext in result:
            ext.cython_gdb = True

    if CYTHON_INSTALLED and use_cython:
        # build .c files right now and convert Extension() objects
        from Cython.Build import cythonize

        result = cythonize(result, compiler_directives=cythonize_directives)

    # for backwards compatibility reasons, provide "etree[_api].h" also as "lxml.etree[_api].h"
    for header_filename in HEADER_FILES:
        src_file = os.path.join(SOURCE_PATH, "lxml", header_filename)
        dst_file = os.path.join(SOURCE_PATH, "lxml", "lxml." + header_filename)
        if not os.path.exists(src_file):
            continue
        if os.path.exists(dst_file) and os.path.getmtime(
                dst_file) >= os.path.getmtime(src_file):
            continue

        with io.open(src_file, "r", encoding="iso8859-1") as f:
            content = f.read()
        for filename in HEADER_FILES:
            content = content.replace('"%s"' % filename,
                                      '"lxml.%s"' % filename)
        with io.open(dst_file, "w", encoding="iso8859-1") as f:
            f.write(content)

    return result
Ejemplo n.º 6
0
def ext_modules(static_include_dirs, static_library_dirs,
                static_cflags, static_binaries):
    global XML2_CONFIG, XSLT_CONFIG
    if OPTION_BUILD_LIBXML2XSLT:
        from buildlibxml import build_libxml2xslt, get_prebuilt_libxml2xslt
        if sys.platform.startswith('win'):
            get_prebuilt_libxml2xslt(
                OPTION_DOWNLOAD_DIR, static_include_dirs, static_library_dirs)
        else:
            XML2_CONFIG, XSLT_CONFIG = build_libxml2xslt(
                OPTION_DOWNLOAD_DIR, 'build/tmp',
                static_include_dirs, static_library_dirs,
                static_cflags, static_binaries,
                libiconv_version=OPTION_LIBICONV_VERSION,
                libxml2_version=OPTION_LIBXML2_VERSION,
                libxslt_version=OPTION_LIBXSLT_VERSION,
                multicore=OPTION_MULTICORE)

    modules = EXT_MODULES
    if OPTION_WITHOUT_OBJECTIFY:
        modules = [entry for entry in modules if 'objectify' not in entry]

    c_files_exist = [os.path.exists('%s%s.c' % (PACKAGE_PATH, module))
                     for module in modules]

    source_extension = ".pyx"
    if CYTHON_INSTALLED and (OPTION_WITH_CYTHON or not all(c_files_exist)):
        print("Building with Cython %s." % Cython.Compiler.Version.version)
        # generate module cleanup code
        from Cython.Compiler import Options
        Options.generate_cleanup_code = 3
        Options.clear_to_none = False
    elif not OPTION_WITHOUT_CYTHON and not all(c_files_exist):
        for exists, module in zip(c_files_exist, modules):
            if not exists:
                raise RuntimeError(
                    "ERROR: Trying to build without Cython, but pre-generated '%s%s.c' "
                    "is not available (pass --without-cython to ignore this error)." % (
                        PACKAGE_PATH, module))
    else:
        if not all(c_files_exist):
            for exists, module in zip(c_files_exist, modules):
                if not exists:
                    print("WARNING: Trying to build without Cython, but pre-generated "
                          "'%s%s.c' is not available." % (PACKAGE_PATH, module))
        source_extension = ".c"
        print("Building without Cython.")

    lib_versions = get_library_versions()
    versions_ok = True
    if lib_versions[0]:
        print("Using build configuration of libxml2 %s and libxslt %s" %
              lib_versions)
        versions_ok = check_min_version(lib_versions[0], (2, 7, 0), 'libxml2')
    else:
        print("Using build configuration of libxslt %s" %
              lib_versions[1])
    versions_ok |= check_min_version(lib_versions[1], (1, 1, 23), 'libxslt')
    if not versions_ok:
        raise RuntimeError("Dependency missing")

    base_dir = get_base_dir()
    _include_dirs = _prefer_reldirs(
        base_dir, include_dirs(static_include_dirs) + [INCLUDE_PACKAGE_PATH])
    _library_dirs = _prefer_reldirs(base_dir, library_dirs(static_library_dirs))
    _cflags = cflags(static_cflags)
    _define_macros = define_macros()
    _libraries = libraries()

    if _library_dirs:
        message = "Building against libxml2/libxslt in "
        if len(_library_dirs) > 1:
            print(message + "one of the following directories:")
            for dir in _library_dirs:
                print("  " + dir)
        else:
            print(message + "the following directory: " +
                  _library_dirs[0])

    if OPTION_AUTO_RPATH:
        runtime_library_dirs = _library_dirs
    else:
        runtime_library_dirs = []

    if CYTHON_INSTALLED and OPTION_SHOW_WARNINGS:
        from Cython.Compiler import Errors
        Errors.LEVEL = 0

    cythonize_options = {}
    if OPTION_WITH_COVERAGE:
        cythonize_options['compiler_directives'] = {'linetrace': True}

    result = []
    for module in modules:
        main_module_source = PACKAGE_PATH + module + source_extension
        result.append(
            Extension(
                module,
                sources = [main_module_source],
                depends = find_dependencies(module),
                extra_compile_args = _cflags,
                extra_objects = static_binaries,
                define_macros = _define_macros,
                include_dirs = _include_dirs,
                library_dirs = _library_dirs,
                runtime_library_dirs = runtime_library_dirs,
                libraries = _libraries,
            ))
    if CYTHON_INSTALLED and OPTION_WITH_CYTHON_GDB:
        for ext in result:
            ext.cython_gdb = True

    if CYTHON_INSTALLED and source_extension == '.pyx':
        # build .c files right now and convert Extension() objects
        from Cython.Build import cythonize
        result = cythonize(result, **cythonize_options)

    return result
Ejemplo n.º 7
0
def ext_modules(static_include_dirs, static_library_dirs, static_cflags,
                static_binaries):
    global XML2_CONFIG, XSLT_CONFIG
    if OPTION_BUILD_LIBXML2XSLT:
        from buildlibxml import build_libxml2xslt
        XML2_CONFIG, XSLT_CONFIG = build_libxml2xslt(
            'libs',
            'build/tmp',
            static_include_dirs,
            static_library_dirs,
            static_cflags,
            static_binaries,
            libxml2_version=OPTION_LIBXML2_VERSION,
            libxslt_version=OPTION_LIBXSLT_VERSION)
    if CYTHON_INSTALLED:
        source_extension = ".pyx"
        print("Building with Cython %s." % Cython.Compiler.Version.version)
    else:
        print("NOTE: Trying to build without Cython, pre-generated "
              "'%slxml.etree.c' needs to be available." % PACKAGE_PATH)
        source_extension = ".c"

    if OPTION_WITHOUT_OBJECTIFY:
        modules = [entry for entry in EXT_MODULES if 'objectify' not in entry]
    else:
        modules = EXT_MODULES

    lib_versions = get_library_versions()
    if lib_versions[0]:
        print("Using build configuration of libxml2 %s and libxslt %s" %
              lib_versions)
    else:
        print("Using build configuration of libxslt %s" % lib_versions[1])

    _include_dirs = include_dirs(static_include_dirs)
    _library_dirs = library_dirs(static_library_dirs)
    _cflags = cflags(static_cflags)
    _define_macros = define_macros()
    _libraries = libraries()

    if _library_dirs:
        message = "Building against libxml2/libxslt in "
        if len(_library_dirs) > 1:
            print(message + "one of the following directories:")
            for dir in _library_dirs:
                print("  " + dir)
        else:
            print(message + "the following directory: " + _library_dirs[0])

    if OPTION_AUTO_RPATH:
        runtime_library_dirs = _library_dirs
    else:
        runtime_library_dirs = []

    if not OPTION_SHOW_WARNINGS:
        _cflags = ['-w'] + _cflags

    result = []
    for module in modules:
        main_module_source = PACKAGE_PATH + module + source_extension
        dependencies = find_dependencies(module)
        result.append(
            Extension(
                module,
                sources=[main_module_source] + dependencies,
                extra_compile_args=_cflags,
                extra_objects=static_binaries,
                define_macros=_define_macros,
                include_dirs=_include_dirs,
                library_dirs=_library_dirs,
                runtime_library_dirs=runtime_library_dirs,
                libraries=_libraries,
            ))
    return result