mirror of
https://github.com/leon-ai/leon.git
synced 2024-12-18 14:21:32 +03:00
Merge branch 'skip-pip-deps' into develop
This commit is contained in:
commit
36b0f68afc
@ -51,7 +51,7 @@ export default () => new Promise(async (resolve, reject) => {
|
|||||||
try {
|
try {
|
||||||
if (process.env.LEON_HTTP_API_KEY === '') {
|
if (process.env.LEON_HTTP_API_KEY === '') {
|
||||||
await generateHttpApiKey()
|
await generateHttpApiKey()
|
||||||
} else {
|
} else if (!process.env.IS_DOCKER) {
|
||||||
const answer = await prompt({
|
const answer = await prompt({
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
name: 'generate.httpApiKey',
|
name: 'generate.httpApiKey',
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { command } from 'execa'
|
import { command } from 'execa'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
import log from '@/helpers/log'
|
import log from '@/helpers/log'
|
||||||
|
|
||||||
@ -31,12 +32,33 @@ export default () => new Promise(async (resolve, reject) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const dotVenvPath = path.join(process.cwd(), 'bridges/python/.venv')
|
||||||
|
const pipfileLockPath = path.join(process.cwd(), 'bridges/python/Pipfile.lock')
|
||||||
|
const pipfileLockMtime = fs.statSync(pipfileLockPath).mtime
|
||||||
|
const isDotVenvExist = fs.existsSync(dotVenvPath)
|
||||||
|
const installPythonPackages = async () => {
|
||||||
// Installing Python packages
|
// Installing Python packages
|
||||||
log.info('Installing Python packages from bridges/python/Pipfile...')
|
log.info('Installing Python packages from bridges/python/Pipfile...')
|
||||||
|
|
||||||
await command('pipenv --three', { shell: true })
|
await command('pipenv --three', { shell: true })
|
||||||
await command('pipenv install', { shell: true })
|
await command('pipenv install', { shell: true })
|
||||||
log.success('Python packages installed')
|
log.success('Python packages installed')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isDotVenvExist) {
|
||||||
|
await installPythonPackages()
|
||||||
|
} else {
|
||||||
|
const dotProjectPath = path.join(process.cwd(), 'bridges/python/.venv/.project')
|
||||||
|
const dotProjectMtime = fs.statSync(dotProjectPath).mtime
|
||||||
|
|
||||||
|
// Check if Python deps tree has been modified since the initial setup
|
||||||
|
if (pipfileLockMtime > dotProjectMtime) {
|
||||||
|
await installPythonPackages()
|
||||||
|
} else {
|
||||||
|
log.success('Python packages are up-to-date')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resolve()
|
resolve()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.error(`Failed to install the Python packages: ${e}`)
|
log.error(`Failed to install the Python packages: ${e}`)
|
||||||
|
Loading…
Reference in New Issue
Block a user