|
1 | 1 | import subprocess |
2 | | - |
3 | | -from setuptools import setup |
| 2 | +from setuptools import setup, find_packages |
4 | 3 | from setuptools.command.build import build |
5 | 4 |
|
| 5 | +def run_xmake_build(): |
| 6 | + print("Running xmake build...") |
| 7 | + subprocess.run(["xmake", "build"], check=True) |
| 8 | + subprocess.run(["xmake", "install"], check=True) |
| 9 | + subprocess.run(["xmake", "build", "-y", "_infinicore"], check=True) |
| 10 | + subprocess.run(["xmake", "install", "_infinicore"], check=True) |
6 | 11 |
|
7 | 12 | class Build(build): |
8 | 13 | def run(self): |
9 | | - subprocess.run(["xmake", "build"]) |
10 | | - subprocess.run(["xmake", "install"]) |
11 | | - subprocess.run(["xmake", "build", "-y", "_infinicore"]) |
12 | | - subprocess.run(["xmake", "install", "_infinicore"]) |
13 | | - |
| 14 | + run_xmake_build() |
| 15 | + super().run() |
14 | 16 |
|
15 | | -setup(package_dir={"": "python"}, cmdclass={"build": Build}) |
| 17 | +setup( |
| 18 | + # 1. Find main packages and manually add test/framework packages |
| 19 | + packages=find_packages(where="python") + [ |
| 20 | + "infinicore.test", |
| 21 | + "infinicore.test.framework" |
| 22 | + ], |
| 23 | + |
| 24 | + # 2. Directory mappings |
| 25 | + package_dir={ |
| 26 | + "": "python", # Root package is under python/ directory |
| 27 | + "infinicore.test": "test/infinicore" # Intermediate package mapping |
| 28 | + }, |
| 29 | + |
| 30 | + # 3. Register commands |
| 31 | + cmdclass={ |
| 32 | + "build": Build |
| 33 | + } |
| 34 | +) |
0 commit comments