MCPcopy Create free account
hub / github.com/numpy/numpy / _link

Method _link

numpy/distutils/command/config.py:112–164  ·  view source on GitHub ↗
(self, body,
               headers, include_dirs,
               libraries, library_dirs, lang)

Source from the content-addressed store, hash-verified

110 return src, obj
111
112 def _link (self, body,
113 headers, include_dirs,
114 libraries, library_dirs, lang):
115 if self.compiler.compiler_type=='msvc':
116 libraries = (libraries or [])[:]
117 library_dirs = (library_dirs or [])[:]
118 if lang in ['f77', 'f90']:
119 lang = 'c' # always use system linker when using MSVC compiler
120 if self.fcompiler:
121 for d in self.fcompiler.library_dirs or []:
122 # correct path when compiling in Cygwin but with
123 # normal Win Python
124 if d.startswith('/usr/lib'):
125 try:
126 d = subprocess.check_output(['cygpath',
127 '-w', d])
128 except (OSError, subprocess.CalledProcessError):
129 pass
130 else:
131 d = filepath_from_subprocess_output(d)
132 library_dirs.append(d)
133 for libname in self.fcompiler.libraries or []:
134 if libname not in libraries:
135 libraries.append(libname)
136 for libname in libraries:
137 if libname.startswith('msvc'): continue
138 fileexists = False
139 for libdir in library_dirs or []:
140 libfile = os.path.join(libdir, '%s.lib' % (libname))
141 if os.path.isfile(libfile):
142 fileexists = True
143 break
144 if fileexists: continue
145 # make g77-compiled static libs available to MSVC
146 fileexists = False
147 for libdir in library_dirs:
148 libfile = os.path.join(libdir, 'lib%s.a' % (libname))
149 if os.path.isfile(libfile):
150 # copy libname.a file to name.lib so that MSVC linker
151 # can find it
152 libfile2 = os.path.join(libdir, '%s.lib' % (libname))
153 copy_file(libfile, libfile2)
154 self.temp_files.append(libfile2)
155 fileexists = True
156 break
157 if fileexists: continue
158 log.warn('could not find library %r in directories %s' \
159 % (libname, library_dirs))
160 elif self.compiler.compiler_type == 'mingw32':
161 generate_manifest(self)
162 return self._wrap_method(old_config._link, lang,
163 (body, headers, include_dirs,
164 libraries, library_dirs, lang))
165
166 def check_header(self, header, include_dirs=None, library_dirs=None, lang='c'):
167 self._check_compiler()

Callers 1

get_outputMethod · 0.95

Calls 7

_wrap_methodMethod · 0.95
generate_manifestFunction · 0.90
startswithMethod · 0.80
warnMethod · 0.80
check_outputMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected