1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-26 10:14:57 +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 { 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 pipfilePath = path.join(process.cwd(), 'bridges/python/Pipfile')
const pipfileLockMtime = fs.statSync(pipfileLockPath).mtime const pipfileMtime = fs.statSync(pipfilePath).mtime
const isDotVenvExist = fs.existsSync(dotVenvPath) const isDotVenvExist = fs.existsSync(dotVenvPath)
const installPythonPackages = async () => { const installPythonPackages = async () => {
// Installing Python packages // Installing Python packages
@ -60,7 +60,7 @@ export default () => new Promise(async (resolve, reject) => {
const dotProjectMtime = fs.statSync(dotProjectPath).mtime const dotProjectMtime = fs.statSync(dotProjectPath).mtime
// Check if Python deps tree has been modified since the initial setup // Check if Python deps tree has been modified since the initial setup
if (pipfileLockMtime > dotProjectMtime) { if (pipfileMtime > dotProjectMtime) {
await installPythonPackages() await installPythonPackages()
} else { } else {
log.success('Python packages are up-to-date') log.success('Python packages are up-to-date')