Build Cactus shared library for Python FFI.
(args)
| 961 | |
| 962 | |
| 963 | def cmd_build_python(args): |
| 964 | """Build Cactus shared library for Python FFI.""" |
| 965 | print_color(BLUE, "Building Cactus for Python...") |
| 966 | print("=" * 30) |
| 967 | |
| 968 | if not check_command('cmake'): |
| 969 | print_color(RED, "Error: CMake is not installed") |
| 970 | print(" macOS: brew install cmake") |
| 971 | print(" Ubuntu: sudo apt-get install cmake") |
| 972 | return 1 |
| 973 | |
| 974 | cactus_dir = PROJECT_ROOT / "cactus" |
| 975 | build_script = cactus_dir / "build.sh" |
| 976 | if not build_script.exists(): |
| 977 | print_color(RED, f"Error: build.sh not found at {build_script}") |
| 978 | return 1 |
| 979 | |
| 980 | result = run_command(str(build_script), cwd=cactus_dir, check=False) |
| 981 | if result.returncode != 0: |
| 982 | print_color(RED, "Build failed") |
| 983 | return 1 |
| 984 | |
| 985 | if platform.system() == "Darwin": |
| 986 | lib_name = "libcactus.dylib" |
| 987 | else: |
| 988 | lib_name = "libcactus.so" |
| 989 | |
| 990 | lib_path = cactus_dir / "build" / lib_name |
| 991 | if not lib_path.exists(): |
| 992 | print_color(RED, f"Shared library not found at {lib_path}") |
| 993 | return 1 |
| 994 | |
| 995 | print_color(GREEN, "Python build complete!") |
| 996 | print(f"Library: {lib_path}") |
| 997 | return 0 |
| 998 | |
| 999 | |
| 1000 | def prompt_for_api_key(config): |
no test coverage detected