1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-25 09:44:22 +03:00

perf: check Pipfile instead of Pipfile.lock to judge whether Python packages must be installed

This commit is contained in:
louistiti 2022-08-23 21:19:23 +08:00
parent 0580cfc54a
commit afdb71f766
No known key found for this signature in database
GPG Key ID: 7ECA3DD523793FE6

View File

@ -32,8 +32,8 @@ export default () => new Promise(async (resolve, reject) => {
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 pipfilePath = path.join(process.cwd(), 'bridges/python/Pipfile')
const pipfileMtime = fs.statSync(pipfilePath).mtime
const isDotVenvExist = fs.existsSync(dotVenvPath)
const installPythonPackages = async () => {
// Installing Python packages
@ -60,7 +60,7 @@ export default () => new Promise(async (resolve, reject) => {
const dotProjectMtime = fs.statSync(dotProjectPath).mtime
// Check if Python deps tree has been modified since the initial setup
if (pipfileLockMtime > dotProjectMtime) {
if (pipfileMtime > dotProjectMtime) {
await installPythonPackages()
} else {
log.success('Python packages are up-to-date')