Skip to content

Commit

Permalink
Enable some windows specific modules
Browse files Browse the repository at this point in the history
  • Loading branch information
naveen521kk authored and lazka committed Jul 19, 2023
1 parent 1e7b24a commit a1dcbd3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Modules/Setup.bootstrap.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ _symtable symtablemodule.c

# build-in modules for windows platform:
@USE_WIN32_MODULE@winreg ../PC/winreg.c
@MODULE_MSVCRT_TRUE@msvcrt -DPy_BUILD_CORE ../PC/msvcrtmodule.c
@MODULE__WINAPI_TRUE@_winapi _winapi.c
2 changes: 2 additions & 0 deletions Modules/_winapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@

#define WINDOWS_LEAN_AND_MEAN
#include "windows.h"
#if defined(Py_DEBUG)
#include <crtdbg.h>
#endif
#include "winreparse.h"

#if defined(MS_WIN32) && !defined(MS_WIN64)
Expand Down
2 changes: 2 additions & 0 deletions PC/msvcrtmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
#include <io.h>
#include <conio.h>
#include <sys/locking.h>
#ifdef _DEBUG
#include <crtdbg.h>
#endif
#include <windows.h>

#ifdef _MSC_VER
Expand Down
2 changes: 1 addition & 1 deletion Python/dynamic_annotations.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* Author: Kostya Serebryany
*/

#ifdef _MSC_VER
#ifdef MS_WINDOWS
# include <windows.h>
#endif

Expand Down
10 changes: 10 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7310,6 +7310,16 @@ PY_STDLIB_MOD([_ssl], [], [test "$ac_cv_working_openssl_ssl" = yes],
PY_STDLIB_MOD([_hashlib], [], [test "$ac_cv_working_openssl_hashlib" = yes],
[$OPENSSL_INCLUDES], [$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $LIBCRYPTO_LIBS])

dnl windows specific modules
PY_STDLIB_MOD([msvcrt], [test "$MACHDEP" = "win32"])
PY_STDLIB_MOD([_winapi], [test "$MACHDEP" = "win32"])
PY_STDLIB_MOD([_msi], [test "$MACHDEP" = "win32"], [], [],
[-lmsi -lcabinet -lrpcrt4])
PY_STDLIB_MOD([winsound], [test "$MACHDEP" = "win32"], [], [],
[-lwinmm])
PY_STDLIB_MOD([_overlapped], [test "$MACHDEP" = "win32"], [], [],
[-lws2_32])

dnl test modules
PY_STDLIB_MOD([_testcapi], [test "$TEST_MODULES" = yes])
PY_STDLIB_MOD([_testclinic], [test "$TEST_MODULES" = yes])
Expand Down
13 changes: 13 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,19 @@ def detect_platform_specific_exts(self):
# macOS-only, needs SystemConfiguration and CoreFoundation framework
self.addext(Extension('_scproxy', ['_scproxy.c']))

# Windows-only modules
if MS_WINDOWS:
srcdir = sysconfig.get_config_var('srcdir')
pc_srcdir = os.path.abspath(os.path.join(srcdir, 'PC'))

self.addext(Extension('_msi',
[os.path.join(pc_srcdir, '_msi.c')]))

self.addext(Extension('winsound',
[os.path.join(pc_srcdir, 'winsound.c')]))

self.addext(Extension('_overlapped', ['overlapped.c']))

def detect_compress_exts(self):
# Andrew Kuchling's zlib module.
self.addext(Extension('zlib', ['zlibmodule.c']))
Expand Down

0 comments on commit a1dcbd3

Please sign in to comment.