-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
69 lines (54 loc) · 2.11 KB
/
setup.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import os
import sys
import sysconfig
from setuptools import setup
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, BASE_DIR)
from buildbase import PlatformTarget, cd, get_build_platform # noqa: E402
def run_setup(build_platform, target_platform):
plat = None
if target_platform.os == "jetson":
plat = "manylinux_2_17_aarch64.manylinux2014_aarch64"
elif target_platform.os == "ubuntu" and target_platform.arch == "armv8":
plat = "manylinux_2_17_aarch64.manylinux2014_aarch64"
elif target_platform.os == "ubuntu" and target_platform.arch == "x86_64":
if target_platform.osver == "22.04":
plat = "manylinux_2_17_x86_64.manylinux2014_x86_64"
if target_platform.osver == "24.04":
plat = "manylinux_2_17_x86_64.manylinux2014_x86_64"
class bdist_wheel(_bdist_wheel):
def finalize_options(self):
_bdist_wheel.finalize_options(self)
self.root_is_pure = False
def get_tag(self):
_, _, plat2 = super().get_tag()
impl = "cp" + sysconfig.get_config_var("py_version_nodot")
return impl, impl, plat if plat is not None else plat2
setup(
url="https://github.com/shiguredo/sora-python-sdk",
packages=["sora_sdk"],
package_dir={"": "src"},
package_data={
"sora_sdk": ["sora_sdk_ext.*"],
},
include_package_data=True,
cmdclass={
"bdist_wheel": bdist_wheel,
},
)
def main():
build_platform = get_build_platform()
target = os.getenv("SORA_SDK_TARGET")
if target is None:
target_platform = build_platform
elif target == "ubuntu-24.04_armv8":
target_platform = PlatformTarget("ubuntu", "24.04", "armv8")
elif target == "ubuntu-22.04_armv8_jetson":
target_platform = PlatformTarget("jetson", None, "armv8", "ubuntu-22.04")
else:
raise Exception(f"Unknown target {target}")
with cd(BASE_DIR):
run_setup(build_platform, target_platform)
if __name__ == "__main__":
main()