Build a static library in a separate sub-process. Parameters ---------- objects : list or tuple of str List of paths to object files used to build the static library. output_libname : str The library name as an absolute or relative (if `output_dir` is used)
(self, objects, output_libname,
output_dir=None, debug=0, target_lang=None)
| 71 | |
| 72 | |
| 73 | def UnixCCompiler_create_static_lib(self, objects, output_libname, |
| 74 | output_dir=None, debug=0, target_lang=None): |
| 75 | """ |
| 76 | Build a static library in a separate sub-process. |
| 77 | |
| 78 | Parameters |
| 79 | ---------- |
| 80 | objects : list or tuple of str |
| 81 | List of paths to object files used to build the static library. |
| 82 | output_libname : str |
| 83 | The library name as an absolute or relative (if `output_dir` is used) |
| 84 | path. |
| 85 | output_dir : str, optional |
| 86 | The path to the output directory. Default is None, in which case |
| 87 | the ``output_dir`` attribute of the UnixCCompiler instance. |
| 88 | debug : bool, optional |
| 89 | This parameter is not used. |
| 90 | target_lang : str, optional |
| 91 | This parameter is not used. |
| 92 | |
| 93 | Returns |
| 94 | ------- |
| 95 | None |
| 96 | |
| 97 | """ |
| 98 | objects, output_dir = self._fix_object_args(objects, output_dir) |
| 99 | |
| 100 | output_filename = \ |
| 101 | self.library_filename(output_libname, output_dir=output_dir) |
| 102 | |
| 103 | if self._need_link(objects, output_filename): |
| 104 | try: |
| 105 | # previous .a may be screwed up; best to remove it first |
| 106 | # and recreate. |
| 107 | # Also, ar on OS X doesn't handle updating universal archives |
| 108 | os.unlink(output_filename) |
| 109 | except OSError: |
| 110 | pass |
| 111 | self.mkpath(os.path.dirname(output_filename)) |
| 112 | tmp_objects = objects + self.objects |
| 113 | while tmp_objects: |
| 114 | objects = tmp_objects[:50] |
| 115 | tmp_objects = tmp_objects[50:] |
| 116 | display = '%s: adding %d object files to %s' % ( |
| 117 | os.path.basename(self.archiver[0]), |
| 118 | len(objects), output_filename) |
| 119 | self.spawn(self.archiver + [output_filename] + objects, |
| 120 | display = display) |
| 121 | |
| 122 | # Not many Unices required ranlib anymore -- SunOS 4.x is, I |
| 123 | # think the only major Unix that does. Maybe we need some |
| 124 | # platform intelligence here to skip ranlib if it's not |
| 125 | # needed -- or maybe Python's configure script took care of |
| 126 | # it for us, hence the check for leading colon. |
| 127 | if self.ranlib: |
| 128 | display = '%s:@ %s' % (os.path.basename(self.ranlib[0]), |
| 129 | output_filename) |
| 130 | try: |
nothing calls this directly
no outgoing calls
no test coverage detected