setup.py 970 Bytes
Newer Older
1
import subprocess
2
from setuptools import setup, find_packages
3
from setuptools.command.build import build
4

5
6
7
8
9
10
def run_xmake_build():
    print("Running xmake build...")
    subprocess.run(["xmake", "build"], check=True)
    subprocess.run(["xmake", "install"], check=True)
    subprocess.run(["xmake", "build", "-y", "_infinicore"], check=True)
    subprocess.run(["xmake", "install", "_infinicore"], check=True)
11

12
class Build(build):
13
    def run(self):
14
15
        run_xmake_build()
        super().run()
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
setup(
    # 1. Find main packages and manually add test/framework packages
    packages=find_packages(where="python") + [
        "infinicore.test", 
        "infinicore.test.framework"
    ],
    
    # 2. Directory mappings
    package_dir={
        "": "python",  # Root package is under python/ directory
        "infinicore.test": "test/infinicore"  # Intermediate package mapping
    },
    
    # 3. Register commands
    cmdclass={
        "build": Build
    }
)