|
40 | 40 | from mypyc.common import IS_FREE_THREADED, RUNTIME_C_FILES, shared_lib_name |
41 | 41 | from mypyc.errors import Errors |
42 | 42 | from mypyc.ir.deps import SourceDep |
43 | | -from mypyc.ir.module_ir import ModuleIR |
44 | 43 | from mypyc.ir.pprint import format_modules |
45 | 44 | from mypyc.namegen import exported_name |
46 | 45 | from mypyc.options import CompilerOptions |
@@ -278,16 +277,6 @@ def include_dir() -> str: |
278 | 277 | return os.path.join(os.path.abspath(os.path.dirname(__file__)), "lib-rt") |
279 | 278 |
|
280 | 279 |
|
281 | | -def collect_source_dependencies(modules: dict[str, ModuleIR]) -> set[SourceDep]: |
282 | | - """Collect all SourceDep dependencies from all modules.""" |
283 | | - source_deps: set[SourceDep] = set() |
284 | | - for module in modules.values(): |
285 | | - for dep in module.dependencies: |
286 | | - if isinstance(dep, SourceDep): |
287 | | - source_deps.add(dep) |
288 | | - return source_deps |
289 | | - |
290 | | - |
291 | 280 | def generate_c( |
292 | 281 | sources: list[BuildSource], |
293 | 282 | options: Options, |
@@ -338,7 +327,7 @@ def generate_c( |
338 | 327 | generate_annotated_html(options.mypyc_annotation_file, result, modules, mapper) |
339 | 328 |
|
340 | 329 | # Collect SourceDep dependencies |
341 | | - source_deps = sorted(collect_source_dependencies(modules), key=lambda d: d.path) |
| 330 | + source_deps = sorted(emitmodule.collect_source_dependencies(modules), key=lambda d: d.path) |
342 | 331 |
|
343 | 332 | return ctext, "\n".join(format_modules(modules)), source_deps |
344 | 333 |
|
@@ -736,7 +725,7 @@ def mypycify( |
736 | 725 | with open(os.path.join(include_dir(), name), encoding="utf-8") as f: |
737 | 726 | write_file(rt_file, f.read()) |
738 | 727 | # Only add .c files to shared_cfilenames |
739 | | - if name.endswith('.c'): |
| 728 | + if name.endswith(".c"): |
740 | 729 | shared_cfilenames.append(rt_file) |
741 | 730 |
|
742 | 731 | extensions = [] |
|
0 commit comments