Skip to content

Commit 4c64d35

Browse files
Roumen PetrovFaraz Shahbazker
authored andcommitted
Issue python#18630: MINGW: exclude unix only modules
1 parent 706301a commit 4c64d35

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

setup.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -773,11 +773,20 @@ def detect_modules(self):
773773
if (config_h_vars.get('FLOCK_NEEDS_LIBBSD', False)):
774774
# May be necessary on AIX for flock function
775775
libs = ['bsd']
776-
exts.append( Extension('fcntl', ['fcntlmodule.c'], libraries=libs) )
776+
if not host_platform.startswith(('mingw', 'win')):
777+
exts.append( Extension('fcntl', ['fcntlmodule.c'], libraries=libs) )
778+
else:
779+
missing.append('fcntl')
777780
# pwd(3)
778-
exts.append( Extension('pwd', ['pwdmodule.c']) )
781+
if not host_platform.startswith(('mingw', 'win')):
782+
exts.append( Extension('pwd', ['pwdmodule.c']) )
783+
else:
784+
missing.append('pwd')
779785
# grp(3)
780-
exts.append( Extension('grp', ['grpmodule.c']) )
786+
if not host_platform.startswith(('mingw', 'win')):
787+
exts.append( Extension('grp', ['grpmodule.c']) )
788+
else:
789+
missing.append('grp')
781790
# spwd, shadow passwords
782791
if (config_h_vars.get('HAVE_GETSPNAM', False) or
783792
config_h_vars.get('HAVE_GETSPENT', False)):
@@ -800,7 +809,10 @@ def detect_modules(self):
800809

801810
# Lance Ellinghaus's syslog module
802811
# syslog daemon interface
803-
exts.append( Extension('syslog', ['syslogmodule.c']) )
812+
if not host_platform.startswith(('mingw', 'win')):
813+
exts.append( Extension('syslog', ['syslogmodule.c']) )
814+
else:
815+
missing.append('syslog')
804816

805817
# Fuzz tests.
806818
exts.append( Extension(
@@ -910,17 +922,23 @@ def detect_modules(self):
910922

911923
# crypt module.
912924

913-
if self.compiler.find_library_file(lib_dirs, 'crypt'):
914-
libs = ['crypt']
925+
if not host_platform.startswith(('mingw', 'win')):
926+
if self.compiler.find_library_file(lib_dirs, 'crypt'):
927+
libs = ['crypt']
928+
else:
929+
libs = []
930+
exts.append( Extension('_crypt', ['_cryptmodule.c'], libraries=libs) )
915931
else:
916-
libs = []
917-
exts.append( Extension('_crypt', ['_cryptmodule.c'], libraries=libs) )
932+
missing.append('_crypt')
918933

919934
# CSV files
920935
exts.append( Extension('_csv', ['_csv.c']) )
921936

922937
# POSIX subprocess module helper.
923-
exts.append( Extension('_posixsubprocess', ['_posixsubprocess.c']) )
938+
if not host_platform.startswith(('mingw', 'win')):
939+
exts.append( Extension('_posixsubprocess', ['_posixsubprocess.c']) )
940+
else:
941+
missing.append('_posixsubprocess')
924942

925943
# socket(2)
926944
socket_libs = []

0 commit comments

Comments
 (0)