@@ -349,20 +349,22 @@ def compile_example(verbose: bool = False) -> None:
349
349
350
350
:param verbose: Boolean value; when ``True``, show output from make command.
351
351
"""
352
- cmd = [
353
- MAKE ,
354
- Path (
355
- os .path .join ('examples' , 'bernoulli' , 'bernoulli' + EXTENSION )
356
- ).as_posix (),
357
- ]
352
+ path = Path ('examples' , 'bernoulli' , 'bernoulli' ).with_suffix (EXTENSION )
353
+ if path .is_file ():
354
+ path .unlink ()
355
+
356
+ cmd = [MAKE , path .as_posix ()]
358
357
try :
359
358
if verbose :
360
359
do_command (cmd )
361
360
else :
362
361
do_command (cmd , fd_out = None )
363
362
except RuntimeError as e :
364
363
# pylint: disable=raise-missing-from
365
- raise CmdStanInstallError (f'Command "make clean-all" failed\n { e } ' )
364
+ raise CmdStanInstallError (f'Command "{ " " .join (cmd )} " failed:\n { e } ' )
365
+
366
+ if not path .is_file ():
367
+ raise CmdStanInstallError ("Failed to generate example binary" )
366
368
367
369
368
370
def rebuild_cmdstan (
@@ -421,8 +423,6 @@ def install_version(
421
423
clean_all (verbose )
422
424
print ('Rebuilding version {}' .format (cmdstan_version ))
423
425
build (verbose , progress = progress , cores = cores )
424
- print ('Test model compilation' )
425
- compile_example (verbose )
426
426
print ('Installed {}' .format (cmdstan_version ))
427
427
428
428
@@ -638,6 +638,10 @@ def run_install(args: Union[InteractiveSettings, InstallationSettings]) -> None:
638
638
else :
639
639
print ('CmdStan version {} already installed' .format (args .version ))
640
640
641
+ with pushd (cmdstan_version ):
642
+ print ('Test model compilation' )
643
+ compile_example (args .verbose )
644
+
641
645
642
646
def parse_cmdline_args () -> Dict [str , Any ]:
643
647
parser = argparse .ArgumentParser ("install_cmdstan" )
0 commit comments