mirror of
https://github.com/leon-ai/leon.git
synced 2025-01-04 15:55:58 +03:00
fix: Python deps tree check
This commit is contained in:
parent
2d0b0f1365
commit
c6c0129158
@ -34,21 +34,29 @@ export default () => new Promise(async (resolve, reject) => {
|
|||||||
try {
|
try {
|
||||||
const dotVenvPath = path.join(process.cwd(), 'bridges/python/.venv')
|
const dotVenvPath = path.join(process.cwd(), 'bridges/python/.venv')
|
||||||
const pipfileLockPath = path.join(process.cwd(), 'bridges/python/Pipfile.lock')
|
const pipfileLockPath = path.join(process.cwd(), 'bridges/python/Pipfile.lock')
|
||||||
const dotProjectPath = path.join(process.cwd(), 'bridges/python/.venv/.project')
|
|
||||||
const isDotVenvExist = fs.existsSync(dotVenvPath)
|
|
||||||
const pipfileLockMtime = fs.statSync(pipfileLockPath).mtime
|
const pipfileLockMtime = fs.statSync(pipfileLockPath).mtime
|
||||||
const dotProjectMtime = fs.statSync(dotProjectPath).mtime
|
const isDotVenvExist = fs.existsSync(dotVenvPath)
|
||||||
|
const installPythonPackages = async () => {
|
||||||
// Check if Python deps tree has been modified since the initial setup
|
|
||||||
if (!isDotVenvExist || (pipfileLockMtime > dotProjectMtime)) {
|
|
||||||
// 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 {
|
} else {
|
||||||
log.success('Python packages are up-to-date')
|
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()
|
||||||
|
Loading…
Reference in New Issue
Block a user