-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.py
More file actions
29 lines (21 loc) · 880 Bytes
/
Copy pathsetup.py
File metadata and controls
29 lines (21 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Packaging entry point.
Mirrors the FlagTree/Triton convention: backend plugin packages living in
``third_party/<vendor>/backend`` are copied into ``sar/backends/<vendor>``
at build time so the installed package is self-contained.
"""
import shutil
from pathlib import Path
from setuptools import setup
from setuptools.command.build_py import build_py
ROOT = Path(__file__).resolve().parent
class BuildPyWithBackends(build_py):
def run(self):
backends_dir = ROOT / "python" / "sar" / "backends"
for vendor_dir in sorted((ROOT / "third_party").glob("*/backend")):
vendor = vendor_dir.parent.name
target = backends_dir / vendor
if target.is_symlink() or target.exists():
continue
shutil.copytree(vendor_dir, target)
super().run()
setup(cmdclass={"build_py": BuildPyWithBackends})