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

Method link

numpy/distutils/fcompiler/__init__.py:650–695  ·  view source on GitHub ↗
(self, target_desc, objects,
             output_filename, output_dir=None, libraries=None,
             library_dirs=None, runtime_library_dirs=None,
             export_symbols=None, debug=0, extra_preargs=None,
             extra_postargs=None, build_temp=None, target_lang=None)

Source from the content-addressed store, hash-verified

648 return "-L" + dir
649
650 def link(self, target_desc, objects,
651 output_filename, output_dir=None, libraries=None,
652 library_dirs=None, runtime_library_dirs=None,
653 export_symbols=None, debug=0, extra_preargs=None,
654 extra_postargs=None, build_temp=None, target_lang=None):
655 objects, output_dir = self._fix_object_args(objects, output_dir)
656 libraries, library_dirs, runtime_library_dirs = \
657 self._fix_lib_args(libraries, library_dirs, runtime_library_dirs)
658
659 lib_opts = gen_lib_options(self, library_dirs, runtime_library_dirs,
660 libraries)
661 if is_string(output_dir):
662 output_filename = os.path.join(output_dir, output_filename)
663 elif output_dir is not None:
664 raise TypeError("'output_dir' must be a string or None")
665
666 if self._need_link(objects, output_filename):
667 if self.library_switch[-1]==' ':
668 o_args = [self.library_switch.strip(), output_filename]
669 else:
670 o_args = [self.library_switch.strip()+output_filename]
671
672 if is_string(self.objects):
673 ld_args = objects + [self.objects]
674 else:
675 ld_args = objects + self.objects
676 ld_args = ld_args + lib_opts + o_args
677 if debug:
678 ld_args[:0] = ['-g']
679 if extra_preargs:
680 ld_args[:0] = extra_preargs
681 if extra_postargs:
682 ld_args.extend(extra_postargs)
683 self.mkpath(os.path.dirname(output_filename))
684 if target_desc == CCompiler.EXECUTABLE:
685 linker = self.linker_exe[:]
686 else:
687 linker = self.linker_so[:]
688 command = linker + ld_args
689 try:
690 self.spawn(command)
691 except DistutilsExecError as e:
692 msg = str(e)
693 raise LinkError(msg) from None
694 else:
695 log.debug("skipping %s (up-to-date)", output_filename)
696
697 def _environment_hook(self, name, hook_name):
698 if hook_name is None:

Callers

nothing calls this directly

Calls 4

gen_lib_optionsFunction · 0.90
is_stringFunction · 0.90
stripMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected