@@ -334,7 +334,72 @@ def _prepare_virtualenv(self, with_json: bool = False) -> None:
334
334
for arg in self .conan_args :
335
335
conan_cmd .append (arg )
336
336
conan_cmd .append (self .profile_path )
337
- self ._run_cmd (conan_cmd , must_succeed = True )
337
+ result = subprocess .run (conan_cmd , check = False , capture_output = True )
338
+ if result .returncode == 0 :
339
+ # Short-circuit out if everything is fine.
340
+ return
341
+
342
+ logging .error ("Error: cannot install virtualenv configuration!" )
343
+ logging .error ("Command:" )
344
+ logging .error (f" { ' ' .join (conan_cmd )} " )
345
+ logging .error ("" )
346
+ logging .error ("Output:" )
347
+
348
+ stderr_lines = result .stderr .decode ().splitlines ()
349
+ for line in stderr_lines :
350
+ logging .error (
351
+ "\n " .join (textwrap .wrap (line , 80 , initial_indent = " " , subsequent_indent = " " , break_long_words = False ))
352
+ )
353
+
354
+ # Here are some errors that can happen and what to do about them.
355
+ # NOTE: Tested with conan 1.60.1, may not match with other Conan versions.
356
+ known_errors = {
357
+ "^ERROR:.* Version range .* from requirement 'cloe-launch-profile/.* could not be resolved.*$" : [
358
+ "It looks like the cloe-launch-profile package hasn't been exported." ,
359
+ "" ,
360
+ "Suggestion:" ,
361
+ " From the cloe repository, try performing the following commands:" ,
362
+ " " ,
363
+ " cd cli" ,
364
+ " conan export ." ,
365
+ "" ,
366
+ ],
367
+ "^ERROR: Failed requirement '([^']+)' from .*$" : [
368
+ "It looks like Conan does not know about one of the packages that" ,
369
+ "the input configuration requires." ,
370
+ "" ,
371
+ "This may be because:" ,
372
+ " - The specification of the requirement in the input configuration is wrong." ,
373
+ " - The required package needs to be exported into Conan cache." ,
374
+ " - The required package needs to be marked editable." ,
375
+ "In the last two cases, the package also needs to be built." ,
376
+ "" ,
377
+ "Suggestion:" ,
378
+ " From the cloe repository, look at the output from `make help`." ,
379
+ " There may be several targets that export the required packages." ,
380
+ ],
381
+ "^ERROR: Missing prebuilt package for '([^']+)'.*$" : [
382
+ "It looks like Conan knows about all required packages, but they are not built." ,
383
+ "" ,
384
+ "If you intend to use the required package in editable mode," ,
385
+ "you need to make this clear to Conan." ,
386
+ "" ,
387
+ "Suggestion:" ,
388
+ " Use cloe-launch to build all necessary packages:" ,
389
+ " " ,
390
+ f" cloe-launch prepare { self .profile_path } " ,
391
+ " " ,
392
+ ],
393
+ }
394
+ for error in stderr_lines :
395
+ for (regex , response ) in known_errors .items ():
396
+ if re .match (regex , error ):
397
+ logging .error ("" )
398
+ logging .error ("Note:" )
399
+ for line in response :
400
+ logging .error (f" { line } " )
401
+ sys .exit (2 )
402
+
338
403
339
404
def _extract_engine_path (self , env : Environment ) -> Path :
340
405
"""Return the first cloe-engine we find in the PATH."""
@@ -353,6 +418,10 @@ def _extract_engine_path(self, env: Environment) -> Path:
353
418
logging .error (
354
419
" However, unconvential or unsupported package configuration may also trigger this."
355
420
)
421
+ logging .error ("" )
422
+ logging .error ("Note: PATH contains these directories:" )
423
+ for bindir in env .get_list ("PATH" , default = []):
424
+ logging .error (f" { bindir } " )
356
425
sys .exit (2 )
357
426
358
427
def _extract_plugin_paths (self , env : Environment ) -> List [Path ]:
0 commit comments