<commit_before>add_python_extension(array SOURCES arraymodule.c)
add_python_extension(audioop SOURCES audioop.c)
add_python_extension(_bisect SOURCES _bisectmodule.c)
add_python_extension(cmath REQUIRES HAVE_LIBM SOURCES _math.c cmathmodule.c LIBRARIES m)
add_python_extension(_codecs_cn SOURCES cjkcodecs/_codecs_cn.c)
add_python_extension(_codecs_hk SOURCES cjkcodecs/_codecs_hk.c)
add_python_extension(_codecs_iso2022 SOURCES cjkcodecs/_codecs_iso2022.c)
add_python_extension(_codecs_jp SOURCES cjkcodecs/_codecs_jp.c)
add_python_extension(_codecs_kr SOURCES cjkcodecs/_codecs_kr.c)
add_python_extension(_codecs_tw SOURCES cjkcodecs/_codecs_tw.c)
add_python_extension(_collections SOURCES _collectionsmodule.c)
add_python_extension(cPickle SOURCES cPickle.c)
add_python_extension(crypt REQUIRES HAVE_LIBCRYPT SOURCES cryptmodule.c LIBRARIES crypt)
add_python_extension(cStringIO SOURCES cStringIO.c)
add_python_extension(_csv SOURCES _csv.c)
add_python_extension(_ctypes_test SOURCES _ctypes/_ctypes_test.c)
add_python_extension(datetime REQUIRES HAVE_LIBM SOURCES datetimemodule.c timemodule.c LIBRARIES m)
if(ENABLE_DATETIME)
    set_property(SOURCE ${CMAKE_SOURCE_DIR}/Modules/datetimemodule.c PROPERTY COMPILE_FLAGS -Wno-unused-value)
endif()
add_python_extension(_functools SOURCES _functoolsmodule.c)
add_python_extension(future_builtins SOURCES future_builtins.c)
add_python_extension(_heapq SOURCES _heapqmodule.c)
add_python_extension(_hotshot SOURCES _hotshot.c)
add_python_extension(_io SOURCES
    _io/_iomodule.c
    _io/bufferedio.c
    _io/bytesio.c
    _io/fileio.c
    _io/iobase.c
    _io/stringio.c
    _io/textio.c
)
add_python_extension(itertools SOURCES itertoolsmodule.c)
add_python_extension(_json SOURCES _json.c)
add_python_extension(_locale SOURCES _localemodule.c)
add_python_extension(_lsprof SOURCES _lsprof.c rotatingtree.c)
add_python_extension(math SOURCES _math.c mathmodule.c)
add_python_extension(mmap SOURCES mmapmodule.c)
add_python_extension(_multibytecodec SOURCES cjkcodecs/multibytecodec.c)
add_python_extension(operator SOURCES operator.c)
add_python_extension(parser SOURCES parsermodule.c)
add_python_extension(_random SOURCES _randommodule.c)
add_python_extension(strop SOURCES stropmodule.c)
add_python_extension(_struct SOURCES _struct.c)
add_python_extension(_testcapi SOURCES _testcapimodule.c)
add_python_extension(time REQUIRES HAVE_LIBM SOURCES timemodule.c LIBRARIES m)
add_python_extension(unicodedata SOURCES unicodedata.c)

# UNIX-only extensions
add_python_extension(fcntl REQUIRES UNIX SOURCES fcntlmodule.c)
add_python_extension(grp REQUIRES UNIX SOURCES grpmodule.c)
add_python_extension(nis REQUIRES UNIX HAVE_LIBNSL SOURCES nismodule.c LIBRARIES nsl)
add_python_extension(posix REQUIRES UNIX BUILTIN SOURCES posixmodule.c)
add_python_extension(pwd REQUIRES UNIX BUILTIN SOURCES pwdmodule.c)
add_python_extension(resource REQUIRES UNIX SOURCES resource.c)
add_python_extension(spwd REQUIRES UNIX HAVE_GETSPNAM HAVE_GETSPENT SOURCES spwdmodule.c)
add_python_extension(syslog REQUIRES UNIX SOURCES syslogmodule.c)
add_python_extension(termios REQUIRES UNIX SOURCES termios.c)

# Linux-only extensions
add_python_extension(linuxaudiodev REQUIRES LINUX SOURCES linuxaudiodev.c)
add_python_extension(ossaudiodev REQUIRES LINUX SOURCES ossaudiodev.c)

# Windows-only extensions
add_python_extension(nt REQUIRES WIN32 BUILTIN SOURCES posixmodule.c)

# Multiprocessing is different on unix and windows
if(UNIX)
    add_python_extension(_multiprocessing
        SOURCES _multiprocessing/multiprocessing.c
                _multiprocessing/semaphore.c
                _multiprocessing/socket_connection.c
    )
    if(ENABLE_MULTIPROCESSING)
        set_property(SOURCE ${CMAKE_SOURCE_DIR}/Modules/semaphore.c PROPERTY COMPILE_FLAGS -Wimplicit-function-declaration)
    endif()
elseif(WIN32)
    add_python_extension(_multiprocessing
        SOURCES _multiprocessing/multiprocessing.c
                _multiprocessing/semaphore.c
                _multiprocessing/pipe_connection.c
                _multiprocessing/socket_connection.c
                _multiprocessing/win32_functions.c
        LIBRARIES ws2_32
    )
endif(UNIX)

# Select needs winsock on Windows
if(WIN32)
    add_python_extension(select SOURCES selectmodule.c LIBRARIES ws2_32)
else(WIN32)
    add_python_extension(select SOURCES selectmodule.c)
endif(WIN32)

# Socket is different on Windows
if(WIN32)
    add_python_extension(_socket
        SOURCES socketmodule.c
        DEFINITIONS EAI_ADDRFAMILY
                    HAVE_SOCKADDR_STORAGE
                    HAVE_ADDRINFO
        LIBRARIES ws2_32
    )
else(WIN32)
    add_python_extension(_socket SOURCES socketmodule.c)
endif(WIN32)

# ctypes is different on Windows
if(WIN32)
    if(MINGW)
		add_python_extension(_ctypes
			SOURCES _ctypes/_ctypes.c
					_ctypes/callbacks.c
					_ctypes/callproc.c
					_ctypes/cfield.c
					_ctypes/libffi_mingw/closures.c
					_ctypes/libffi_mingw/debug.c
					_ctypes/libffi_mingw/prep_cif.c
					_ctypes/libffi_mingw/raw_api.c
					_ctypes/libffi_mingw/x86/ffi.c
					_ctypes/libffi_mingw/x86/win32.S
					_ctypes/stgdict.c
			INCLUDEDIRS ${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/src/x86
						${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/include
			DEFINITIONS X86_WIN32
		)
    endif(MINGW)
else(WIN32)
    if(APPLE)
        # TODO - Jc:02/20/2013
        #add_python_extension(_ctypes
        #    SOURCES _ctypes/_ctypes.c
        #            _ctypes/callbacks.c
        #            _ctypes/callproc.c
        #            _ctypes/cfield.c
        #            _ctypes/libffi_osx/src/closures.c
        #            _ctypes/libffi_osx/src/dlmalloc.c
        #            _ctypes/libffi_osx/x86/ffi.c
        #            _ctypes/libffi_osx/x86/ffi64.c
        #            _ctypes/libffi_osx/src/prep_cif.c
        #            _ctypes/stgdict.c
        #            _ctypes/libffi_osx/x86/sysv.S
        #            _ctypes/libffi_osx/x86/darwin64.S
        #    INCLUDEDIRS ${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/src/x86
        #                ${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/include
        #)
    else(APPLE)
        add_python_extension(_ctypes
            SOURCES _ctypes/_ctypes.c
                    _ctypes/callbacks.c
                    _ctypes/callproc.c
                    _ctypes/cfield.c
                    _ctypes/libffi/src/closures.c
                    _ctypes/libffi/src/dlmalloc.c
                    _ctypes/libffi/src/x86/ffi.c
                    _ctypes/libffi/src/x86/ffi64.c
                    _ctypes/libffi/src/prep_cif.c
                    _ctypes/stgdict.c
                    _ctypes/libffi/src/x86/sysv.S
                    _ctypes/libffi/src/x86/unix64.S
            INCLUDEDIRS ${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/src/x86
                        ${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/include
        )
    endif(APPLE)
endif(WIN32)


# Build expat using the system expat if it's installed, otherwise use the
# builtin version.
if(EXPAT_FOUND)
    add_python_extension(pyexpat
        SOURCES pyexpat.c
        LIBRARIES ${EXPAT_LIBRARIES}
        INCLUDEDIRS ${EXPAT_INCLUDE_DIRS}
    )
    add_python_extension(_elementtree
        SOURCES _elementtree.c
        LIBRARIES ${EXPAT_LIBRARIES}
        INCLUDEDIRS ${EXPAT_INCLUDE_DIRS}
    )
else(EXPAT_FOUND)
    add_python_extension(pyexpat
        SOURCES pyexpat.c
                expat/xmlparse.c
                expat/xmlrole.c
                expat/xmltok.c
        DEFINITIONS HAVE_EXPAT_CONFIG_H=1
        INCLUDEDIRS ${CMAKE_SOURCE_DIR}/Modules/expat
    )
    add_python_extension(_elementtree
        SOURCES _elementtree.c
        DEFINITIONS HAVE_EXPAT_CONFIG_H=1 USE_PYEXPAT_CAPI
        INCLUDEDIRS ${CMAKE_SOURCE_DIR}/Modules/expat
    )
endif(EXPAT_FOUND)

# If openssl is NOT available then build some other hash implementations
if(OPENSSL_FOUND)
    set(OPENSSL_NOT_FOUND OFF)
else(OPENSSL_FOUND)
    set(OPENSSL_NOT_FOUND ON)
endif(OPENSSL_FOUND)

add_python_extension(_md5 REQUIRES OPENSSL_NOT_FOUND SOURCES md5.c md5module.c)
add_python_extension(_sha REQUIRES OPENSSL_NOT_FOUND SOURCES shamodule.c)
add_python_extension(_sha256 REQUIRES OPENSSL_NOT_FOUND SOURCES sha256module.c)
add_python_extension(_sha512 REQUIRES OPENSSL_NOT_FOUND SOURCES sha512module.c)

# Extensions that depend on other libraries
add_python_extension(binascii
    REQUIRES ZLIB_FOUND
    SOURCES binascii.c
    DEFINITIONS USE_ZLIB_CRC32
    LIBRARIES ${ZLIB_LIBRARIES}
)
add_python_extension(_bsddb
    REQUIRES DB_INCLUDE_PATH DB_LIBRARIES
    SOURCES _bsddb.c
    LIBRARIES ${DB_LIBRARIES}
    INCLUDEDIRS ${DB_INCLUDE_PATH}
)
add_python_extension(bz2<commit_msg>Fix windows build of pyexpat/elementtree passing the expected definition<commit_after>add_python_extension(array SOURCES arraymodule.c)
add_python_extension(audioop SOURCES audioop.c)
add_python_extension(_bisect SOURCES _bisectmodule.c)
add_python_extension(cmath REQUIRES HAVE_LIBM SOURCES _math.c cmathmodule.c LIBRARIES m)
add_python_extension(_codecs_cn SOURCES cjkcodecs/_codecs_cn.c)
add_python_extension(_codecs_hk SOURCES cjkcodecs/_codecs_hk.c)
add_python_extension(_codecs_iso2022 SOURCES cjkcodecs/_codecs_iso2022.c)
add_python_extension(_codecs_jp SOURCES cjkcodecs/_codecs_jp.c)
add_python_extension(_codecs_kr SOURCES cjkcodecs/_codecs_kr.c)
add_python_extension(_codecs_tw SOURCES cjkcodecs/_codecs_tw.c)
add_python_extension(_collections SOURCES _collectionsmodule.c)
add_python_extension(cPickle SOURCES cPickle.c)
add_python_extension(crypt REQUIRES HAVE_LIBCRYPT SOURCES cryptmodule.c LIBRARIES crypt)
add_python_extension(cStringIO SOURCES cStringIO.c)
add_python_extension(_csv SOURCES _csv.c)
add_python_extension(_ctypes_test SOURCES _ctypes/_ctypes_test.c)
add_python_extension(datetime REQUIRES HAVE_LIBM SOURCES datetimemodule.c timemodule.c LIBRARIES m)
if(ENABLE_DATETIME)
    set_property(SOURCE ${CMAKE_SOURCE_DIR}/Modules/datetimemodule.c PROPERTY COMPILE_FLAGS -Wno-unused-value)
endif()
add_python_extension(_functools SOURCES _functoolsmodule.c)
add_python_extension(future_builtins SOURCES future_builtins.c)
add_python_extension(_heapq SOURCES _heapqmodule.c)
add_python_extension(_hotshot SOURCES _hotshot.c)
add_python_extension(_io SOURCES
    _io/_iomodule.c
    _io/bufferedio.c
    _io/bytesio.c
    _io/fileio.c
    _io/iobase.c
    _io/stringio.c
    _io/textio.c
)
add_python_extension(itertools SOURCES itertoolsmodule.c)
add_python_extension(_json SOURCES _json.c)
add_python_extension(_locale SOURCES _localemodule.c)
add_python_extension(_lsprof SOURCES _lsprof.c rotatingtree.c)
add_python_extension(math SOURCES _math.c mathmodule.c)
add_python_extension(mmap SOURCES mmapmodule.c)
add_python_extension(_multibytecodec SOURCES cjkcodecs/multibytecodec.c)
add_python_extension(operator SOURCES operator.c)
add_python_extension(parser SOURCES parsermodule.c)
add_python_extension(_random SOURCES _randommodule.c)
add_python_extension(strop SOURCES stropmodule.c)
add_python_extension(_struct SOURCES _struct.c)
add_python_extension(_testcapi SOURCES _testcapimodule.c)
add_python_extension(time REQUIRES HAVE_LIBM SOURCES timemodule.c LIBRARIES m)
add_python_extension(unicodedata SOURCES unicodedata.c)

# UNIX-only extensions
add_python_extension(fcntl REQUIRES UNIX SOURCES fcntlmodule.c)
add_python_extension(grp REQUIRES UNIX SOURCES grpmodule.c)
add_python_extension(nis REQUIRES UNIX HAVE_LIBNSL SOURCES nismodule.c LIBRARIES nsl)
add_python_extension(posix REQUIRES UNIX BUILTIN SOURCES posixmodule.c)
add_python_extension(pwd REQUIRES UNIX BUILTIN SOURCES pwdmodule.c)
add_python_extension(resource REQUIRES UNIX SOURCES resource.c)
add_python_extension(spwd REQUIRES UNIX HAVE_GETSPNAM HAVE_GETSPENT SOURCES spwdmodule.c)
add_python_extension(syslog REQUIRES UNIX SOURCES syslogmodule.c)
add_python_extension(termios REQUIRES UNIX SOURCES termios.c)

# Linux-only extensions
add_python_extension(linuxaudiodev REQUIRES LINUX SOURCES linuxaudiodev.c)
add_python_extension(ossaudiodev REQUIRES LINUX SOURCES ossaudiodev.c)

# Windows-only extensions
add_python_extension(nt REQUIRES WIN32 BUILTIN SOURCES posixmodule.c)

# Multiprocessing is different on unix and windows
if(UNIX)
    add_python_extension(_multiprocessing
        SOURCES _multiprocessing/multiprocessing.c
                _multiprocessing/semaphore.c
                _multiprocessing/socket_connection.c
    )
    if(ENABLE_MULTIPROCESSING)
        set_property(SOURCE ${CMAKE_SOURCE_DIR}/Modules/semaphore.c PROPERTY COMPILE_FLAGS -Wimplicit-function-declaration)
    endif()
elseif(WIN32)
    add_python_extension(_multiprocessing
        SOURCES _multiprocessing/multiprocessing.c
                _multiprocessing/semaphore.c
                _multiprocessing/pipe_connection.c
                _multiprocessing/socket_connection.c
                _multiprocessing/win32_functions.c
        LIBRARIES ws2_32
    )
endif(UNIX)

# Select needs winsock on Windows
if(WIN32)
    add_python_extension(select SOURCES selectmodule.c LIBRARIES ws2_32)
else(WIN32)
    add_python_extension(select SOURCES selectmodule.c)
endif(WIN32)

# Socket is different on Windows
if(WIN32)
    add_python_extension(_socket
        SOURCES socketmodule.c
        DEFINITIONS EAI_ADDRFAMILY
                    HAVE_SOCKADDR_STORAGE
                    HAVE_ADDRINFO
        LIBRARIES ws2_32
    )
else(WIN32)
    add_python_extension(_socket SOURCES socketmodule.c)
endif(WIN32)

# ctypes is different on Windows
if(WIN32)
    if(MINGW)
		add_python_extension(_ctypes
			SOURCES _ctypes/_ctypes.c
					_ctypes/callbacks.c
					_ctypes/callproc.c
					_ctypes/cfield.c
					_ctypes/libffi_mingw/closures.c
					_ctypes/libffi_mingw/debug.c
					_ctypes/libffi_mingw/prep_cif.c
					_ctypes/libffi_mingw/raw_api.c
					_ctypes/libffi_mingw/x86/ffi.c
					_ctypes/libffi_mingw/x86/win32.S
					_ctypes/stgdict.c
			INCLUDEDIRS ${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/src/x86
						${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/include
			DEFINITIONS X86_WIN32
		)
    endif(MINGW)
else(WIN32)
    if(APPLE)
        # TODO - Jc:02/20/2013
        #add_python_extension(_ctypes
        #    SOURCES _ctypes/_ctypes.c
        #            _ctypes/callbacks.c
        #            _ctypes/callproc.c
        #            _ctypes/cfield.c
        #            _ctypes/libffi_osx/src/closures.c
        #            _ctypes/libffi_osx/src/dlmalloc.c
        #            _ctypes/libffi_osx/x86/ffi.c
        #            _ctypes/libffi_osx/x86/ffi64.c
        #            _ctypes/libffi_osx/src/prep_cif.c
        #            _ctypes/stgdict.c
        #            _ctypes/libffi_osx/x86/sysv.S
        #            _ctypes/libffi_osx/x86/darwin64.S
        #    INCLUDEDIRS ${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/src/x86
        #                ${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/include
        #)
    else(APPLE)
        add_python_extension(_ctypes
            SOURCES _ctypes/_ctypes.c
                    _ctypes/callbacks.c
                    _ctypes/callproc.c
                    _ctypes/cfield.c
                    _ctypes/libffi/src/closures.c
                    _ctypes/libffi/src/dlmalloc.c
                    _ctypes/libffi/src/x86/ffi.c
                    _ctypes/libffi/src/x86/ffi64.c
                    _ctypes/libffi/src/prep_cif.c
                    _ctypes/stgdict.c
                    _ctypes/libffi/src/x86/sysv.S
                    _ctypes/libffi/src/x86/unix64.S
            INCLUDEDIRS ${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/src/x86
                        ${CMAKE_SOURCE_DIR}/Modules/_ctypes/libffi/include
        )
    endif(APPLE)
endif(WIN32)


# Build expat using the system expat if it's installed, otherwise use the
# builtin version.
if(EXPAT_FOUND)
    add_python_extension(pyexpat
        SOURCES pyexpat.c
        LIBRARIES ${EXPAT_LIBRARIES}
        INCLUDEDIRS ${EXPAT_INCLUDE_DIRS}
    )
    add_python_extension(_elementtree
        SOURCES _elementtree.c
        LIBRARIES ${EXPAT_LIBRARIES}
        INCLUDEDIRS ${EXPAT_INCLUDE_DIRS}
    )
else(EXPAT_FOUND)
    set(_pyexpat_definitions )
	if(MSVC)
        set(_pyexpat_definitions PYEXPAT_EXPORTS HAVE_EXPAT_H XML_NS XML_DTD BYTEORDER=1234 XML_CONTEXT_BYTES=1024 XML_STATIC HAVE_MEMMOVE)
    endif(MSVC)
    add_python_extension(pyexpat
        SOURCES pyexpat.c
                expat/xmlparse.c
                expat/xmlrole.c
                expat/xmltok.c
        DEFINITIONS ${_pyexpat_definitions} #HAVE_EXPAT_CONFIG_H=1
        INCLUDEDIRS ${CMAKE_SOURCE_DIR}/Modules/expat
    )
	set(_elementtree_definitions)
	if(MSVC)
	    set(_elementtree_definitions XML_NS XML_DTD BYTEORDER=1234 XML_CONTEXT_BYTES=1024 USE_PYEXPAT_CAPI XML_STATIC HAVE_MEMMOVE)
	endif()
    add_python_extension(_elementtree
        SOURCES _elementtree.c
        DEFINITIONS ${_elementtree_definitions} #USE_PYEXPAT_CAPI HAVE_EXPAT_CONFIG_H=1
        INCLUDEDIRS ${CMAKE_SOURCE_DIR}/Modules/expat
    )
endif(EXPAT_FOUND)

# If openssl is NOT available then build some other hash implementations
if(OPENSSL_FOUND)
    set(OPENSSL_NOT_FOUND OFF)
else(OPENSSL_FOUND)
    set(OPENSSL_NOT_FOUND ON)
endif(OPENSSL_FOUND)

add_python_extension(_md5 REQUIRES OPENSSL_NOT_FOUND SOURCES md5.c md5module.c)
add_python_extension(_sha REQUIRES OPENSSL_NOT_FOUND SOURCES shamodule.c)
add_python_extension(_sha256 REQUIRES OPENSSL_NOT_FOUND SOURCES sha256module.c)
add_python_extension(_sha512 REQUIRES OPENSSL_NOT_FOUND SOURCES sha512module.c)

# Extensions that depend on other libraries
add_python_extension(binascii
    REQUIRES ZLIB_FOUND
    SOURCES binascii.c
    DEFINITIONS USE_ZLIB_CRC32
    LIBRARIES ${ZLIB_LIBRARIES}
)
add_python_extension(_bsddb
    REQUIRES DB_INCLUDE_PATH DB_LIBRARIES
    SOURCES _bsddb.c
    LIBRARIES ${DB_LIBRARIES}
    INCLUDEDIRS ${DB_INCLUDE_PATH}
)
add_python_extension(bz2
{'fraction_non_alphanumeric': 0.06383691706227311, 'fraction_numerical': 0.013068975146607093, 'mean_word_length': 3.583056053237778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1055028', 'n_tokens_mistral': 7085, 'n_tokens_neox': 6473, 'n_words': 964}