Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

github actions

tilakpatel22bc017ee54fe8
diff --git a/.github/workflows/test-macos-setup.yml b/.github/workflows/test-macos-setup.yml
new file mode 100644
index 000000000..1f916d163
--- /dev/null
+++ b/.github/workflows/test-macos-setup.yml
@@ -0,0 +1,252 @@
+name: Test macOS Setup Dependencies
+
+on:
+ workflow_dispatch:
+ pull_request:
+ paths:
+ - 'fincept-terminal-desktop/src-tauri/src/setup.rs'
+ - 'fincept-terminal-desktop/src-tauri/resources/requirements-numpy1.txt'
+ - 'fincept-terminal-desktop/src-tauri/resources/requirements-numpy2.txt'
+
+jobs:
+ test-precompiled-wheels:
+ name: Test Pre-compiled Wheels (${{ matrix.arch }})
+ strategy:
+ matrix:
+ include:
+ - runner: macos-14
+ arch: Apple Silicon (ARM64)
+ python-url: https://github.com/astral-sh/python-build-standalone/releases/download/20241217/cpython-3.12.8+20241217-aarch64-apple-darwin-install_only.tar.gz
+ - runner: macos-13
+ arch: Intel (x64)
+ python-url: https://github.com/astral-sh/python-build-standalone/releases/download/20241217/cpython-3.12.8+20241217-x86_64-apple-darwin-install_only.tar.gz
+
+ runs-on: ${{ matrix.runner }}
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Test Python download and extraction
+ run: |
+ echo "Testing Python download for ${{ matrix.arch }}"
+ mkdir -p test-python
+ curl -L -o test-python/python.tar.gz "${{ matrix.python-url }}"
+
+ echo "File downloaded, checking size..."
+ ls -lh test-python/python.tar.gz
+ file test-python/python.tar.gz
+
+ echo "Testing gunzip..."
+ gunzip test-python/python.tar.gz
+
+ echo "Testing tar extraction..."
+ tar -xf test-python/python.tar -C test-python --strip-components=1
+
+ echo "Checking extracted files..."
+ ls -la test-python/bin/ || echo "No bin directory found"
+ test-python/bin/python3 --version || echo "Python executable test failed"
+
+ echo "✅ Python extraction successful"
+
+ - name: Test llvmlite/numba wheel availability
+ run: |
+ echo "Testing llvmlite and numba wheel availability..."
+ python3 -m pip install --dry-run llvmlite==0.43.0 numba==0.60.0 2>&1 | tee wheel_test.log
+
+ if grep -q "Building wheel" wheel_test.log; then
+ echo "⚠️ WARNING: Packages require compilation (no pre-built wheels)"
+ echo "needs_compilation=true" >> $GITHUB_OUTPUT
+ else
+ echo "✅ Pre-built wheels available"
+ echo "needs_compilation=false" >> $GITHUB_OUTPUT
+ fi
+ id: wheel_check
+
+ - name: Test vnpy wheel availability
+ run: |
+ echo "Testing vnpy wheel availability..."
+ python3 -m pip install --dry-run vnpy==4.3.0 2>&1 | tee vnpy_test.log
+
+ if grep -q "Building wheel" vnpy_test.log; then
+ echo "⚠️ WARNING: vnpy requires compilation (likely needs TA-Lib)"
+ echo "vnpy_needs_compilation=true" >> $GITHUB_OUTPUT
+ else
+ echo "✅ vnpy has pre-built wheels"
+ echo "vnpy_needs_compilation=false" >> $GITHUB_OUTPUT
+ fi
+ id: vnpy_check
+
+ - name: Summary
+ run: |
+ echo "## Test Results for ${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "- Python extraction: ✅ Success" >> $GITHUB_STEP_SUMMARY
+ echo "- llvmlite/numba: ${{ steps.wheel_check.outputs.needs_compilation == 'true' && '⚠️ Needs LLVM' || '✅ Pre-built' }}" >> $GITHUB_STEP_SUMMARY
+ echo "- vnpy: ${{ steps.vnpy_check.outputs.vnpy_needs_compilation == 'true' && '⚠️ Needs TA-Lib' || '✅ Pre-built' }}" >> $GITHUB_STEP_SUMMARY
+
+ test-homebrew-installation:
+ name: Test Homebrew Dependencies
+ runs-on: macos-14
+
+ steps:
+ - name: Verify Homebrew exists
+ run: |
+ echo "Checking Homebrew installation..."
+ brew --version
+ echo "✅ Homebrew is available"
+
+ - name: Test LLVM installation via Homebrew
+ run: |
+ echo "Installing LLVM via Homebrew..."
+ brew install llvm@14
+
+ echo "Checking LLVM installation..."
+ brew --prefix llvm@14
+
+ LLVM_PATH=$(brew --prefix llvm@14)
+ echo "LLVM installed at: $LLVM_PATH"
+
+ if [ -f "$LLVM_PATH/bin/llvm-config" ]; then
+ echo "✅ LLVM installation successful"
+ $LLVM_PATH/bin/llvm-config --version
+ else
+ echo "❌ LLVM installation failed"
+ exit 1
+ fi
+
+ - name: Test TA-Lib installation via Homebrew
+ run: |
+ echo "Installing TA-Lib via Homebrew..."
+ brew install ta-lib
+
+ echo "Checking TA-Lib installation..."
+ brew --prefix ta-lib
+
+ TALIB_PATH=$(brew --prefix ta-lib)
+ echo "TA-Lib installed at: $TALIB_PATH"
+
+ if [ -f "$TALIB_PATH/lib/libta_lib.a" ] || [ -f "$TALIB_PATH/lib/libta_lib.dylib" ]; then
+ echo "✅ TA-Lib installation successful"
+ ls -la $TALIB_PATH/lib/
+ else
+ echo "❌ TA-Lib installation failed"
+ exit 1
+ fi
+
+ - name: Test package installation with Homebrew dependencies
+ run: |
+ echo "Testing package installation with Homebrew LLVM and TA-Lib..."
+
+ LLVM_PATH=$(brew --prefix llvm@14)
+ TALIB_PATH=$(brew --prefix ta-lib)
+
+ export LLVM_CONFIG="$LLVM_PATH/bin/llvm-config"
+ export TA_INCLUDE_PATH="$TALIB_PATH/include"
+ export TA_LIBRARY_PATH="$TALIB_PATH/lib"
+
+ echo "Environment variables set:"
+ echo "LLVM_CONFIG=$LLVM_CONFIG"
+ echo "TA_INCLUDE_PATH=$TA_INCLUDE_PATH"
+ echo "TA_LIBRARY_PATH=$TA_LIBRARY_PATH"
+
+ python3 -m pip install llvmlite==0.43.0 numba==0.60.0 --no-cache-dir
+ echo "✅ llvmlite and numba installed successfully"
+
+ - name: Summary
+ run: |
+ echo "## Homebrew Installation Test Results" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "- Homebrew: ✅ Available" >> $GITHUB_STEP_SUMMARY
+ echo "- LLVM@14: ✅ Installed" >> $GITHUB_STEP_SUMMARY
+ echo "- TA-Lib: ✅ Installed" >> $GITHUB_STEP_SUMMARY
+ echo "- Package compilation: ✅ Success" >> $GITHUB_STEP_SUMMARY
+
+ test-precompiled-binaries:
+ name: Test Pre-compiled LLVM Binary
+ runs-on: macos-14
+
+ steps:
+ - name: Test LLVM pre-compiled binary download
+ run: |
+ echo "Testing LLVM pre-compiled binary download..."
+ mkdir -p test-llvm
+
+ LLVM_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-arm64-apple-darwin22.0.tar.xz"
+
+ curl -L -o test-llvm/llvm.tar.xz "$LLVM_URL"
+
+ echo "File downloaded, checking..."
+ ls -lh test-llvm/llvm.tar.xz
+ file test-llvm/llvm.tar.xz
+
+ echo "Extracting..."
+ tar -xf test-llvm/llvm.tar.xz -C test-llvm --strip-components=1
+
+ echo "Checking extracted files..."
+ if [ -f "test-llvm/bin/llvm-config" ]; then
+ echo "✅ LLVM pre-compiled binary extraction successful"
+ test-llvm/bin/llvm-config --version
+ else
+ echo "❌ LLVM extraction failed"
+ exit 1
+ fi
+
+ - name: Test TA-Lib source compilation
+ run: |
+ echo "Testing TA-Lib source compilation..."
+ mkdir -p test-talib
+
+ curl -L -o test-talib/ta-lib.tar.gz "https://downloads.sourceforge.net/project/ta-lib/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz"
+
+ echo "Extracting source..."
+ gunzip test-talib/ta-lib.tar.gz
+ tar -xf test-talib/ta-lib.tar -C test-talib --strip-components=1
+
+ cd test-talib
+
+ echo "Configuring..."
+ ./configure --prefix=$(pwd)
+
+ echo "Compiling..."
+ make
+
+ echo "Installing..."
+ make install
+
+ if [ -f "lib/libta_lib.a" ]; then
+ echo "✅ TA-Lib compilation successful"
+ ls -la lib/
+ else
+ echo "❌ TA-Lib compilation failed"
+ exit 1
+ fi
+
+ - name: Summary
+ run: |
+ echo "## Pre-compiled Binary Test Results" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "- LLVM binary download: ✅ Success" >> $GITHUB_STEP_SUMMARY
+ echo "- LLVM extraction: ✅ Success" >> $GITHUB_STEP_SUMMARY
+ echo "- TA-Lib source download: ✅ Success" >> $GITHUB_STEP_SUMMARY
+ echo "- TA-Lib compilation: ✅ Success" >> $GITHUB_STEP_SUMMARY
+
+ recommendation:
+ name: Generate Recommendation
+ needs: [test-precompiled-wheels, test-homebrew-installation, test-precompiled-binaries]
+ runs-on: ubuntu-latest
+ if: always()
+
+ steps:
+ - name: Final Recommendation
+ run: |
+ echo "# macOS Setup Test Summary" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "## All Tests Completed" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "### Recommendations:" >> $GITHUB_STEP_SUMMARY
+ echo "1. Check individual job results above" >> $GITHUB_STEP_SUMMARY
+ echo "2. If pre-compiled wheels available → Remove LLVM/TA-Lib code" >> $GITHUB_STEP_SUMMARY
+ echo "3. If compilation needed → Keep current implementation" >> $GITHUB_STEP_SUMMARY
+ echo "4. Homebrew approach works but requires admin password" >> $GITHUB_STEP_SUMMARY
+ echo "5. Pre-compiled binaries work without admin access" >> $GITHUB_STEP_SUMMARY
diff --git a/fincept-terminal-desktop/src-tauri/Cargo.lock b/fincept-terminal-desktop/src-tauri/Cargo.lock
index a338cdb4c..c6215a68f 100644
--- a/fincept-terminal-desktop/src-tauri/Cargo.lock
+++ b/fincept-terminal-desktop/src-tauri/Cargo.lock
@@ -1688,7 +1688,7 @@ dependencies = [
[[package]]
name = "fincept-terminal-desktop"
-version = "3.1.4"
+version = "3.1.5"
dependencies = [
"ahash 0.8.12",
"anyhow",
diff --git a/fincept-terminal-desktop/src-tauri/src/setup.rs b/fincept-terminal-desktop/src-tauri/src/setup.rs
index be6f3e885..2c147fb3e 100644
--- a/fincept-terminal-desktop/src-tauri/src/setup.rs
+++ b/fincept-terminal-desktop/src-tauri/src/setup.rs
@@ -132,46 +132,38 @@ fn check_bun(install_dir: &PathBuf) -> (bool, Option<String>) {
/// Check LLVM installation (macOS only, needed for llvmlite/numba)
#[cfg(target_os = "macos")]
-fn check_llvm() -> (bool, Option<String>) {
- // Check if llvm@14 is installed via Homebrew
- let mut cmd = Command::new("brew");
- cmd.args(&["--prefix", "llvm@14"]);
+fn check_llvm(install_dir: &PathBuf) -> (bool, Option<String>) {
+ let llvm_dir = install_dir.join("llvm");
+ let llvm_config = llvm_dir.join("bin/llvm-config");
- if let Ok(output) = cmd.output() {
- if output.status.success() {
- let path = String::from_utf8_lossy(&output.stdout).trim().to_string();
- return (true, Some(path));
- }
+ if llvm_config.exists() {
+ return (true, Some(llvm_dir.to_string_lossy().to_string()));
}
(false, None)
}
#[cfg(not(target_os = "macos"))]
-fn check_llvm() -> (bool, Option<String>) {
+fn check_llvm(_install_dir: &PathBuf) -> (bool, Option<String>) {
// LLVM not needed on Windows/Linux for our use case
(true, Some("Not required".to_string()))
}
/// Check TA-Lib installation (needed for ta-lib Python wrapper)
#[cfg(target_os = "macos")]
-fn check_talib() -> (bool, Option<String>) {
- // Check if ta-lib is installed via Homebrew
- let mut cmd = Command::new("brew");
- cmd.args(&["--prefix", "ta-lib"]);
+fn check_talib(install_dir: &PathBuf) -> (bool, Option<String>) {
+ let talib_dir = install_dir.join("ta-lib");
+ let talib_lib = talib_dir.join("lib/libta_lib.a");
- if let Ok(output) = cmd.output() {
- if output.status.success() {
- let path = String::from_utf8_lossy(&output.stdout).trim().to_string();
- return (true, Some(path));
- }
+ if talib_lib.exists() {
+ return (true, Some(talib_dir.to_string_lossy().to_string()));
}
(false, None)
}
#[cfg(not(target_os = "macos"))]
-fn check_talib() -> (bool, Option<String>) {
+fn check_talib(_install_dir: &PathBuf) -> (bool, Option<String>) {
// For Windows/Linux, check if ta-lib headers are available
// This is a simplified check - may need platform-specific logic
(true, Some("Check manually".to_string()))
@@ -312,6 +304,8 @@ async fn install_python(app: &AppHandle, install_dir: &PathBuf) -> Result<(), St
let download_url = format!("https://github.com/astral-sh/python-build-standalone/releases/download/20241217/cpython-3.12.8+20241217-{}.tar.gz", platform);
let tar_path = python_dir.join("python.tar.gz");
+ emit_progress(app, "python", 40, "Downloading Python...", false);
+
let mut cmd = Command::new("curl");
cmd.args(&["-L", "-o", tar_path.to_str().unwrap(), &download_url]);
let output = cmd.output().map_err(|e| format!("Download failed: {}", e))?;
@@ -319,17 +313,32 @@ async fn install_python(app: &AppHandle, install_dir: &PathBuf) -> Result<(), St
return Err(format!("Download failed: {}", String::from_utf8_lossy(&output.stderr)));
}
+ eprintln!("[SETUP] Download complete, file size: {} bytes",
+ std::fs::metadata(&tar_path).map(|m| m.len()).unwrap_or(0));
+
+ emit_progress(app, "python", 50, "Decompressing archive...", false);
+
+ // Use gunzip separately for better BSD tar compatibility
+ let mut gunzip_cmd = Command::new("gunzip");
+ gunzip_cmd.arg(tar_path.to_str().unwrap());
+ let output = gunzip_cmd.output().map_err(|e| format!("Gunzip failed: {}", e))?;
+ if !output.status.success() {
+ return Err(format!("Gunzip failed: {}", String::from_utf8_lossy(&output.stderr)));
+ }
+
emit_progress(app, "python", 60, "Extracting Python...", false);
+ // Extract the uncompressed tar file
+ let tar_uncompressed = python_dir.join("python.tar");
let mut cmd = Command::new("tar");
- cmd.args(&["-xzf", tar_path.to_str().unwrap(), "-C", python_dir.to_str().unwrap(), "--strip-components=1"]);
+ cmd.args(&["-xf", tar_uncompressed.to_str().unwrap(), "-C", python_dir.to_str().unwrap(), "--strip-components=1"]);
let output = cmd.output().map_err(|e| format!("Extract failed: {}", e))?;
if !output.status.success() {
return Err(format!("Extract failed: {}", String::from_utf8_lossy(&output.stderr)));
}
// Cleanup
- let _ = std::fs::remove_file(&tar_path);
+ let _ = std::fs::remove_file(&tar_uncompressed);
// Check what was extracted
eprintln!("[SETUP] Checking extracted Python files...");
@@ -575,68 +584,136 @@ async fn install_bun(app: &AppHandle, install_dir: &PathBuf) -> Result<(), Strin
/// Install LLVM (macOS only, needed for llvmlite/numba)
#[cfg(target_os = "macos")]
-async fn install_llvm(app: &AppHandle) -> Result<(), String> {
+async fn install_llvm(app: &AppHandle, install_dir: &PathBuf) -> Result<(), String> {
emit_progress(app, "llvm", 0, "Installing LLVM...", false);
- // First check if Homebrew is installed
- let brew_check = Command::new("which").arg("brew").output();
+ let llvm_dir = install_dir.join("llvm");
+ std::fs::create_dir_all(&llvm_dir)
+ .map_err(|e| format!("Failed to create LLVM dir: {}", e))?;
- if brew_check.is_err() || !brew_check.unwrap().status.success() {
- return Err("Homebrew is not installed. Please install Homebrew first: https://brew.sh".to_string());
- }
+ // Detect architecture
+ let arch = std::env::consts::ARCH;
+ let (platform, llvm_version) = if arch == "aarch64" {
+ ("arm64-apple-darwin22.0", "17.0.6")
+ } else {
+ ("x86_64-apple-darwin22.0", "17.0.6")
+ };
- emit_progress(app, "llvm", 20, "Installing LLVM via Homebrew...", false);
+ emit_progress(app, "llvm", 20, "Downloading LLVM...", false);
- // Install LLVM using Homebrew
- let mut cmd = Command::new("brew");
- cmd.args(&["install", "llvm@14"]);
+ let download_url = format!(
+ "https://github.com/llvm/llvm-project/releases/download/llvmorg-{}/clang+llvm-{}-{}.tar.xz",
+ llvm_version, llvm_version, platform
+ );
+ let tar_path = llvm_dir.join("llvm.tar.xz");
- eprintln!("[SETUP] Installing LLVM: {:?}", cmd);
- let output = cmd.output().map_err(|e| format!("Failed to install LLVM: {}", e))?;
+ let mut cmd = Command::new("curl");
+ cmd.args(&["-L", "-o", tar_path.to_str().unwrap(), &download_url]);
+ let output = cmd.output().map_err(|e| format!("LLVM download failed: {}", e))?;
+ if !output.status.success() {
+ return Err(format!("LLVM download failed: {}", String::from_utf8_lossy(&output.stderr)));
+ }
- eprintln!("[SETUP] LLVM stdout: {}", String::from_utf8_lossy(&output.stdout));
- eprintln!("[SETUP] LLVM stderr: {}", String::from_utf8_lossy(&output.stderr));
+ eprintln!("[SETUP] LLVM download complete, file size: {} bytes",
+ std::fs::metadata(&tar_path).map(|m| m.len()).unwrap_or(0));
+ emit_progress(app, "llvm", 60, "Extracting LLVM...", false);
+
+ // Extract tar.xz
+ let mut cmd = Command::new("tar");
+ cmd.args(&["-xf", tar_path.to_str().unwrap(), "-C", llvm_dir.to_str().unwrap(), "--strip-components=1"]);
+ let output = cmd.output().map_err(|e| format!("LLVM extract failed: {}", e))?;
if !output.status.success() {
- return Err(format!("LLVM installation failed: {}", String::from_utf8_lossy(&output.stderr)));
+ return Err(format!("LLVM extract failed: {}", String::from_utf8_lossy(&output.stderr)));
}
+ let _ = std::fs::remove_file(&tar_path);
+
emit_progress(app, "llvm", 100, "LLVM installed", false);
Ok(())
}
#[cfg(not(target_os = "macos"))]
-async fn install_llvm(_app: &AppHandle) -> Result<(), String> {
+async fn install_llvm(_app: &AppHandle, _install_dir: &PathBuf) -> Result<(), String> {
// LLVM not needed on Windows/Linux
Ok(())
}
/// Install TA-Lib (needed for ta-lib Python wrapper)
#[cfg(target_os = "macos")]
-async fn install_talib(app: &AppHandle) -> Result<(), String> {
+async fn install_talib(app: &AppHandle, install_dir: &PathBuf) -> Result<(), String> {
emit_progress(app, "talib", 0, "Installing TA-Lib...", false);
- // First check if Homebrew is installed
- let brew_check = Command::new("which").arg("brew").output();
+ let talib_dir = install_dir.join("ta-lib");
+ std::fs::create_dir_all(&talib_dir)
+ .map_err(|e| format!("Failed to create TA-Lib dir: {}", e))?;
+
+ emit_progress(app, "talib", 20, "Downloading TA-Lib...", false);
+
+ // Download TA-Lib source
+ let talib_version = "0.4.0";
+ let download_url = format!("https://downloads.sourceforge.net/project/ta-lib/ta-lib/{}/ta-lib-{}-src.tar.gz", talib_version, talib_version);
+ let tar_path = talib_dir.join("ta-lib.tar.gz");
+
+ let mut cmd = Command::new("curl");
+ cmd.args(&["-L", "-o", tar_path.to_str().unwrap(), &download_url]);
+ let output = cmd.output().map_err(|e| format!("TA-Lib download failed: {}", e))?;
+ if !output.status.success() {
+ return Err(format!("TA-Lib download failed: {}", String::from_utf8_lossy(&output.stderr)));
+ }
+
+ eprintln!("[SETUP] TA-Lib download complete, file size: {} bytes",
+ std::fs::metadata(&tar_path).map(|m| m.len()).unwrap_or(0));
+
+ emit_progress(app, "talib", 40, "Extracting TA-Lib...", false);
- if brew_check.is_err() || !brew_check.unwrap().status.success() {
- return Err("Homebrew is not installed. Please install Homebrew first: https://brew.sh".to_string());
+ // Decompress
+ let mut gunzip_cmd = Command::new("gunzip");
+ gunzip_cmd.arg(tar_path.to_str().unwrap());
+ let output = gunzip_cmd.output().map_err(|e| format!("TA-Lib gunzip failed: {}", e))?;
+ if !output.status.success() {
+ return Err(format!("TA-Lib gunzip failed: {}", String::from_utf8_lossy(&output.stderr)));
}
- emit_progress(app, "talib", 20, "Installing TA-Lib via Homebrew...", false);
+ // Extract
+ let tar_uncompressed = talib_dir.join("ta-lib.tar");
+ let mut cmd = Command::new("tar");
+ cmd.args(&["-xf", tar_uncompressed.to_str().unwrap(), "-C", talib_dir.to_str().unwrap(), "--strip-components=1"]);
+ let output = cmd.output().map_err(|e| format!("TA-Lib extract failed: {}", e))?;
+ if !output.status.success() {
+ return Err(format!("TA-Lib extract failed: {}", String::from_utf8_lossy(&output.stderr)));
+ }
- // Install TA-Lib using Homebrew
- let mut cmd = Command::new("brew");
- cmd.args(&["install", "ta-lib"]);
+ let _ = std::fs::remove_file(&tar_uncompressed);
- eprintln!("[SETUP] Installing TA-Lib: {:?}", cmd);
- let output = cmd.output().map_err(|e| format!("Failed to install TA-Lib: {}", e))?;
+ emit_progress(app, "talib", 60, "Compiling TA-Lib...", false);
- eprintln!("[SETUP] TA-Lib stdout: {}", String::from_utf8_lossy(&output.stdout));
- eprintln!("[SETUP] TA-Lib stderr: {}", String::from_utf8_lossy(&output.stderr));
+ // Configure and compile (install to ta-lib dir)
+ let configure_script = talib_dir.join("configure");
+ let mut cmd = Command::new(&configure_script);
+ cmd.args(&["--prefix", talib_dir.to_str().unwrap()]);
+ cmd.current_dir(&talib_dir);
+ let output = cmd.output().map_err(|e| format!("TA-Lib configure failed: {}", e))?;
+ if !output.status.success() {
+ return Err(format!("TA-Lib configure failed: {}", String::from_utf8_lossy(&output.stderr)));
+ }
+
+ emit_progress(app, "talib", 80, "Building TA-Lib (this may take a few minutes)...", false);
+
+ // Make and install
+ let mut cmd = Command::new("make");
+ cmd.current_dir(&talib_dir);
+ let output = cmd.output().map_err(|e| format!("TA-Lib make failed: {}", e))?;
+ if !output.status.success() {
+ return Err(format!("TA-Lib make failed: {}", String::from_utf8_lossy(&output.stderr)));
+ }
+ let mut cmd = Command::new("make");
+ cmd.arg("install");
+ cmd.current_dir(&talib_dir);
+ let output = cmd.output().map_err(|e| format!("TA-Lib install failed: {}", e))?;
if !output.status.success() {
- return Err(format!("TA-Lib installation failed: {}", String::from_utf8_lossy(&output.stderr)));
+ return Err(format!("TA-Lib install failed: {}", String::from_utf8_lossy(&output.stderr)));
}
emit_progress(app, "talib", 100, "TA-Lib installed", false);
@@ -644,7 +721,7 @@ async fn install_talib(app: &AppHandle) -> Result<(), String> {
}
#[cfg(not(target_os = "macos"))]
-async fn install_talib(_app: &AppHandle) -> Result<(), String> {
+async fn install_talib(_app: &AppHandle, _install_dir: &PathBuf) -> Result<(), String> {
// For Windows/Linux, TA-Lib needs to be installed manually
eprintln!("[SETUP] TA-Lib installation on Windows/Linux requires manual setup");
Ok(())
@@ -790,12 +867,12 @@ async fn install_packages_in_venv(
// On macOS, set LLVM and TA-Lib environment variables for package builds
#[cfg(target_os = "macos")]
{
- if let (true, Some(llvm_path)) = check_llvm() {
+ if let (true, Some(llvm_path)) = check_llvm(install_dir) {
eprintln!("[SETUP] Setting LLVM environment variables for package build");
cmd.env("LLVM_CONFIG", format!("{}/bin/llvm-config", llvm_path));
}
- if let (true, Some(talib_path)) = check_talib() {
+ if let (true, Some(talib_path)) = check_talib(install_dir) {
eprintln!("[SETUP] Setting TA-Lib environment variables for package build");
cmd.env("TA_INCLUDE_PATH", format!("{}/include", talib_path));
cmd.env("TA_LIBRARY_PATH", format!("{}/lib", talib_path));
@@ -836,8 +913,8 @@ pub fn check_setup_status(app: AppHandle) -> Result<SetupStatus, String> {
let (python_installed, _) = check_python(&install_dir);
let (bun_installed, _) = check_bun(&install_dir);
- let (llvm_installed, _) = check_llvm();
- let (talib_installed, _) = check_talib();
+ let (llvm_installed, _) = check_llvm(&install_dir);
+ let (talib_installed, _) = check_talib(&install_dir);
let packages_installed = check_packages(&install_dir);
// On macOS, LLVM and TA-Lib are required for full package installation
@@ -917,18 +994,18 @@ pub async fn run_setup(app: AppHandle) -> Result<String, String> {
}
// LLVM (macOS only, needed for llvmlite/numba in financial packages)
- let (llvm_installed, llvm_path) = check_llvm();
+ let (llvm_installed, llvm_path) = check_llvm(&install_dir);
if !llvm_installed {
- install_llvm(&app).await?;
+ install_llvm(&app, &install_dir).await?;
} else {
eprintln!("[SETUP] LLVM already installed: {}", llvm_path.unwrap_or_default());
emit_progress(&app, "llvm", 100, "LLVM already installed", false);
}
// TA-Lib (needed for ta-lib Python wrapper used by vnpy)
- let (talib_installed, talib_path) = check_talib();
+ let (talib_installed, talib_path) = check_talib(&install_dir);
if !talib_installed {
- install_talib(&app).await?;
+ install_talib(&app, &install_dir).await?;
} else {
eprintln!("[SETUP] TA-Lib already installed: {}", talib_path.unwrap_or_default());
emit_progress(&app, "talib", 100, "TA-Lib already installed", false);