|
1 | 1 | from os import environ |
| 2 | +from pathlib import Path |
2 | 3 | from sys import platform |
3 | 4 | from platform import machine |
4 | 5 | from hatchling.builders.hooks.plugin.interface import BuildHookInterface |
5 | 6 |
|
| 7 | + |
6 | 8 | class CustomHook(BuildHookInterface): |
7 | 9 | def initialize(self, version, build_data): |
8 | | - build_data['pure_python'] = False |
| 10 | + build_data["pure_python"] = False |
9 | 11 | arch = environ.get("AUDITWHEEL_ARCH", machine()) |
10 | 12 | if "darwin" in platform: |
11 | 13 | if "arm" in arch: |
12 | | - build_data['tag'] = "py3-none-macosx_11_0_arm64" |
| 14 | + build_data["tag"] = "py3-none-macosx_11_0_arm64" |
13 | 15 | else: |
14 | | - build_data['tag'] = "py3-none-macosx_11_0_x86_64" |
| 16 | + build_data["tag"] = "py3-none-macosx_11_0_x86_64" |
15 | 17 | elif "linux" in platform: |
16 | 18 | if "arm" in arch or "aarch" in arch: |
17 | | - build_data['tag'] = "py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64" |
| 19 | + build_data["tag"] = "py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64" |
18 | 20 | else: |
19 | | - build_data['tag'] = 'py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64' |
| 21 | + build_data["tag"] = "py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64" |
20 | 22 | else: |
21 | | - build_data['tag'] = "py3-none-win_amd64" |
| 23 | + build_data["tag"] = "py3-none-win_amd64" |
| 24 | + |
| 25 | + # Include native verible binaries as scripts so they land in $PREFIX/bin |
| 26 | + bins_dir = Path(self.root) / "verible" / "bin" |
| 27 | + if bins_dir.is_dir(): |
| 28 | + shared = build_data.setdefault("shared_data", {}) |
| 29 | + for f in bins_dir.iterdir(): |
| 30 | + if f.is_file(): |
| 31 | + shared[str(f.relative_to(self.root))] = f"scripts/{f.name}" |
0 commit comments