setup.py 1.08 KB
Newer Older
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import subprocess
from pathlib import Path

from setuptools import setup
from setuptools.command.build import build
from setuptools.command.develop import develop
from setuptools.command.egg_info import egg_info


def build_cpp_module():
    """Build and install the C++ extension module"""
    subprocess.run(["xmake", "build", "_infinilm_llama"], check=True)
    subprocess.run(["xmake", "install", "_infinilm_llama"], check=True)


class Build(build):
    def run(self):
        build_cpp_module()
        super().run()


class Develop(develop):
    def run(self):
        build_cpp_module()
        super().run()


class EggInfo(egg_info):
    def run(self):
        # Ensure C++ module is built before creating egg-info
        build_cpp_module()
        super().run()


setup(
    name="InfiniLM",
    version="0.1.0",
    description="InfiniLM model implementations",
    package_dir={"": "python"},
    packages=["infinilm", "infinilm.models", "infinilm.lib"],
    cmdclass={
        "build": Build,
        "develop": Develop,
        "egg_info": EggInfo,
    },
    python_requires=">=3.10",
)