(dataFolderPath: string)
| 411 | } |
| 412 | |
| 413 | private async installDependencies(dataFolderPath: string) { |
| 414 | if (!this.SurferPythonPath) { |
| 415 | throw new Error('Python path is not set. Cannot install dependencies.'); |
| 416 | } |
| 417 | |
| 418 | const pythonPath = `"${this.SurferPythonPath}"`; |
| 419 | const pipCommand = `${pythonPath} -m pip`; |
| 420 | |
| 421 | const commands = [ |
| 422 | `${pipCommand} install --upgrade pip`, |
| 423 | `${pipCommand} install -r "${path.join(dataFolderPath, 'requirements.txt')}"`, |
| 424 | ]; |
| 425 | |
| 426 | for (const command of commands) { |
| 427 | console.log(`Executing: ${command}`); |
| 428 | try { |
| 429 | await execAsync(command, { shell: true }); |
| 430 | } catch (error) { |
| 431 | console.error(`Error executing command: ${command}`, error); |
| 432 | throw error; |
| 433 | } |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | private async runCommand(command: string, args: string[]): Promise<void> { |
| 438 | return new Promise((resolve, reject) => { |
nothing calls this directly
no outgoing calls
no test coverage detected