MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

Tools/c-analyzer/distutils/cygwinccompiler.py:94–151  ·  view source on GitHub ↗
(self, verbose=0, dry_run=0, force=0)

Source from the content-addressed store, hash-verified

92 exe_extension = ".exe"
93
94 def __init__(self, verbose=0, dry_run=0, force=0):
95
96 UnixCCompiler.__init__(self, verbose, dry_run, force)
97
98 status, details = check_config_h()
99 self.debug_print("Python's GCC status: %s (details: %s)" %
100 (status, details))
101 if status is not CONFIG_H_OK:
102 self.warn(
103 "Python's pyconfig.h doesn't seem to support your compiler. "
104 "Reason: %s. "
105 "Compiling may fail because of undefined preprocessor macros."
106 % details)
107
108 self.gcc_version, self.ld_version, self.dllwrap_version = \
109 get_versions()
110 self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" %
111 (self.gcc_version,
112 self.ld_version,
113 self.dllwrap_version) )
114
115 # ld_version >= "2.10.90" and < "2.13" should also be able to use
116 # gcc -mdll instead of dllwrap
117 # Older dllwraps had own version numbers, newer ones use the
118 # same as the rest of binutils ( also ld )
119 # dllwrap 2.10.90 is buggy
120 if self.ld_version >= "2.10.90":
121 self.linker_dll = "gcc"
122 else:
123 self.linker_dll = "dllwrap"
124
125 # ld_version >= "2.13" support -shared so use it instead of
126 # -mdll -static
127 if self.ld_version >= "2.13":
128 shared_option = "-shared"
129 else:
130 shared_option = "-mdll -static"
131
132 # Hard-code GCC because that's what this is all about.
133 # XXX optimization, warnings etc. should be customizable.
134 self.set_executables(compiler='gcc -mcygwin -O -Wall',
135 compiler_so='gcc -mcygwin -mdll -O -Wall',
136 compiler_cxx='g++ -mcygwin -O -Wall',
137 linker_exe='gcc -mcygwin',
138 linker_so=('%s -mcygwin %s' %
139 (self.linker_dll, shared_option)))
140
141 # cygwin and mingw32 need different sets of libraries
142 if self.gcc_version == "2.91.57":
143 # cygwin shouldn't need msvcrt, but without the dlls will crash
144 # (gcc version 2.91.57) -- perhaps something about initialization
145 self.dll_libraries=["msvcrt"]
146 self.warn(
147 "Consider upgrading to a newer version of gcc")
148 else:
149 # Include the appropriate MSVC runtime library if Python was built
150 # with MSVC 7.0 or later.
151 self.dll_libraries = get_msvcr()

Callers 1

__init__Method · 0.45

Calls 5

check_config_hFunction · 0.85
get_versionsFunction · 0.85
get_msvcrFunction · 0.85
set_executablesMethod · 0.80
warnMethod · 0.45

Tested by

no test coverage detected