@@ -405,24 +405,26 @@ public static void createVenv(Path venvDirectory, List<String> packages, Path la
405405 trim (packages );
406406 }
407407
408- checkLauncher (venvDirectory , launcherPath , log );
409-
410- var tag = venvDirectory .resolve ("contents" );
411408 List <String > installedPackages = new ArrayList <>();
409+ var tag = venvDirectory .resolve ("contents" );
412410
413- if (Files .isReadable (tag )) {
414- List <String > lines = null ;
415- try {
416- lines = Files .readAllLines (tag );
417- } catch (IOException e ) {
418- throw new IOException (String .format ("failed to read tag file %s" , tag ), e );
419- }
420- if (lines .isEmpty () || !graalPyVersion .equals (lines .get (0 ))) {
421- log .info (String .format ("Stale GraalPy venv, updating to %s" , graalPyVersion ));
422- delete (venvDirectory );
423- } else {
424- for (int i = 1 ; i < lines .size (); i ++) {
425- installedPackages .add (lines .get (i ));
411+ if (Files .exists (venvDirectory )) {
412+ checkLauncher (venvDirectory , launcherPath , log );
413+
414+ if (Files .isReadable (tag )) {
415+ List <String > lines = null ;
416+ try {
417+ lines = Files .readAllLines (tag );
418+ } catch (IOException e ) {
419+ throw new IOException (String .format ("failed to read tag file %s" , tag ), e );
420+ }
421+ if (lines .isEmpty () || !graalPyVersion .equals (lines .get (0 ))) {
422+ log .info (String .format ("Stale GraalPy venv, updating to %s" , graalPyVersion ));
423+ delete (venvDirectory );
424+ } else {
425+ for (int i = 1 ; i < lines .size (); i ++) {
426+ installedPackages .add (lines .get (i ));
427+ }
426428 }
427429 }
428430 }
0 commit comments