4040 */
4141package org .graalvm .python .embedding .tools .vfs ;
4242
43+ import VFSUtils .LockFile ;
4344import java .io .Serial ;
4445import org .graalvm .python .embedding .tools .exec .BuildToolLog ;
4546import org .graalvm .python .embedding .tools .exec .BuildToolLog .CollectOutputLog ;
@@ -552,24 +553,24 @@ public static void createVenv(Path venvDirectory, List<String> packages, Path lo
552553
553554 static boolean installPackagesFromReqFile (Path venvDirectory , Launcher launcher , String graalPyVersion ,
554555 BuildToolLog log , Path lockFilePath , Path reqFile ) throws IOException {
555- if (reqFile != null && Files .exists (reqFile )) {
556- log .info ("Using <requirements.txt> dependency mode." );
557- log .info ("Installing Python dependencies from: " + reqFile );
556+ if (reqFile == null || !Files .exists (reqFile )) {
557+ return false ;
558+ }
559+ log .info ("Using <requirements.txt> dependency mode." );
560+ log .info ("Installing Python dependencies from: " + reqFile );
558561
559- warnIfLockFileExists (lockFilePath , log );
562+ warnIfLockFileExists (lockFilePath , log );
560563
561- VenvContents vc = ensureVenv (venvDirectory , graalPyVersion , launcher , log );
564+ VenvContents vc = ensureVenv (venvDirectory , graalPyVersion , launcher , log );
562565
563- runPip (venvDirectory , "install" , log , "--compile" , "-r" , reqFile .toString ());
564- List <String > reqPackages = requirementsPackages (reqFile );
565- vc .write (reqPackages );
566+ runPip (venvDirectory , "install" , log , "--compile" , "-r" , reqFile .toString ());
567+ List <String > reqPackages = requirementsPackages (reqFile );
568+ vc .write (reqPackages );
566569
567- InstalledPackages installed = InstalledPackages .fromVenv (venvDirectory );
568- installed .freeze (log );
570+ InstalledPackages installed = InstalledPackages .fromVenv (venvDirectory );
571+ installed .freeze (log );
569572
570- return true ;
571- }
572- return false ;
573+ return true ;
573574 }
574575
575576 private static void warnIfLockFileExists (Path lockFilePath , BuildToolLog log ) {
@@ -591,7 +592,7 @@ static void installPackages(Path venvDirectory, List<String> packages, Path lock
591592
592593 List <String > pluginPackages = trim (packages );
593594
594- LockFile lockFile = null ;
595+ VFSUtils . LockFile lockFile = null ;
595596 if (lockFilePath != null && Files .exists (lockFilePath )) {
596597 log .info ("Lock-file detected: " + lockFilePath );
597598 lockFile = LockFile .fromFile (lockFilePath , log );
0 commit comments