Copy PEP 561 typing files next to the compiled extension.
| 43 | |
| 44 | |
| 45 | class build_ext_with_typing(build_ext): |
| 46 | """Copy PEP 561 typing files next to the compiled extension.""" |
| 47 | typing_files = ("seal.pyi", "py.typed") |
| 48 | |
| 49 | def run(self): |
| 50 | super().run() |
| 51 | self._copy_typing_files() |
| 52 | |
| 53 | def _copy_typing_files(self): |
| 54 | output_dirs = {Path(self.build_lib)} |
| 55 | if self.inplace: |
| 56 | output_dirs.add(BASE_DIR) |
| 57 | |
| 58 | for target_dir in output_dirs: |
| 59 | target_dir.mkdir(parents=True, exist_ok=True) |
| 60 | for filename in self.typing_files: |
| 61 | source = BASE_DIR / filename |
| 62 | if source.exists(): |
| 63 | destination = target_dir / filename |
| 64 | if source.resolve() == destination.resolve(): |
| 65 | continue |
| 66 | copy2(source, destination) |
| 67 | |
| 68 | |
| 69 | ext_modules = [ |
nothing calls this directly
no outgoing calls
no test coverage detected