This commit is contained in:
tunm
2025-05-22 16:07:26 +08:00
parent efb5639ec6
commit 7e25e4e482
168 changed files with 6434 additions and 2527 deletions

View File

@@ -7,14 +7,17 @@ import os
def get_version():
"""Get version number"""
version_path = os.path.join(os.path.dirname(__file__), 'version.txt')
with open(version_path, 'r') as f:
return f.read().strip()
try:
with open(version_path, 'r') as f:
return f.read().strip()
except FileNotFoundError:
return "0.0.0"
def get_wheel_platform_tag():
"""Get wheel package platform tag"""
system = platform.system().lower()
machine = platform.machine().lower()
arch_mapping = {
'x86_64': {
'windows': 'win_amd64',
@@ -37,7 +40,10 @@ def get_wheel_platform_tag():
'darwin': 'macosx_11_0_arm64'
}
}
platform_arch = arch_mapping.get(machine, {}).get(system)
if os.getenv('INSPIRE_FACE_TARGET_AARCH_MAPPING'):
platform_arch = os.getenv('INSPIRE_FACE_TARGET_AARCH_MAPPING')
else:
platform_arch = arch_mapping.get(machine, {}).get(system)
if not platform_arch:
print("Unsupported platform: {} {}".format(system, machine))
raise RuntimeError("Unsupported platform: {} {}".format(system, machine))
@@ -77,8 +83,22 @@ class BinaryDistWheel(bdist_wheel):
self.plat_name = get_wheel_platform_tag()
self.universal = False
def get_target_platform_for_envs():
"""Get target platform for environments"""
system = os.environ.get('INSPIRE_FACE_TARGET_PLATFORM')
if system is None:
system = get_lib_path_info()[0]
machine = os.environ.get('INSPIRE_FACE_TARGET_ARCH')
if machine is None:
machine = get_lib_path_info()[1]
return system, machine
# Get current platform information
system, arch = get_lib_path_info()
system, arch = get_target_platform_for_envs()
print(f"Building for system: {system}, arch: {arch}")
# Build library file path relative to package
lib_path = os.path.join('modules', 'core', 'libs', system, arch, '*')