(self)
| 551 | """ |
| 552 | |
| 553 | def run(self): |
| 554 | # Copy python files to the output directory. This set of files is |
| 555 | # defined by the py_module list and package_data patterns. |
| 556 | build_py.run(self) |
| 557 | |
| 558 | # dst_root is the root of the `executorch` module in the output package |
| 559 | # directory. build_lib is the platform-independent root of the output |
| 560 | # package, and will look like `pip-out/lib`. It can contain multiple |
| 561 | # python packages, so be sure to copy the files into the `executorch` |
| 562 | # package subdirectory. |
| 563 | if self.editable_mode: |
| 564 | # In editable mode, the package directory is the original source directory |
| 565 | dst_root = self.get_package_dir("executorch") |
| 566 | else: |
| 567 | dst_root = os.path.join(self.build_lib, "executorch") |
| 568 | # Create the version file. |
| 569 | Version.write_to_python_file(os.path.join(dst_root, "version.py")) |
| 570 | |
| 571 | # Manually copy files into the output package directory. These are |
| 572 | # typically python "resource" files that will live alongside the python |
| 573 | # code that uses them. |
| 574 | src_to_dst = [ |
| 575 | # TODO(dbort): See if we can add a custom pyproject.toml section for |
| 576 | # these, instead of hard-coding them here. See |
| 577 | # https://setuptools.pypa.io/en/latest/userguide/extension.html |
| 578 | ("schema/scalar_type.fbs", "exir/_serialize/scalar_type.fbs"), |
| 579 | ("schema/program.fbs", "exir/_serialize/program.fbs"), |
| 580 | ( |
| 581 | "devtools/bundled_program/schema/bundled_program_schema.fbs", |
| 582 | "devtools/bundled_program/serialize/bundled_program_schema.fbs", |
| 583 | ), |
| 584 | ( |
| 585 | "devtools/bundled_program/schema/scalar_type.fbs", |
| 586 | "devtools/bundled_program/serialize/scalar_type.fbs", |
| 587 | ), |
| 588 | # Install executorch-wheel-config.cmake to pip package. |
| 589 | ( |
| 590 | "tools/cmake/executorch-wheel-config.cmake", |
| 591 | "share/cmake/executorch-config.cmake", |
| 592 | ), |
| 593 | ] |
| 594 | # Copy all the necessary headers into include/executorch/ so that they can |
| 595 | # be found in the pip package. This is the subset of headers that are |
| 596 | # essential for building custom ops extensions. |
| 597 | # TODO: Use cmake to gather the headers instead of hard-coding them here. |
| 598 | # For example: |
| 599 | # https://discourse.cmake.org/t/installing-headers-the-modern-way-regurgitated-and-revisited/3238/3 |
| 600 | for include_dir in [ |
| 601 | "runtime/core/", |
| 602 | "runtime/executor/", |
| 603 | "runtime/kernel/", |
| 604 | "runtime/backend/", |
| 605 | "runtime/platform/", |
| 606 | "extension/kernel_util/", |
| 607 | "extension/tensor/", |
| 608 | "extension/threadpool/", |
| 609 | ]: |
| 610 | src_list = Path(include_dir).rglob("*.h") |
nothing calls this directly
no test coverage detected