From 6d3882840dbbe75820f8f0d36cca3c94079b4b33 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Thu, 25 Mar 2021 19:36:16 -0600 Subject: move execution check after print so dry-run actually works --- yapymake/makefile/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/yapymake/makefile/__init__.py b/yapymake/makefile/__init__.py index 086ea2c..0a272cf 100644 --- a/yapymake/makefile/__init__.py +++ b/yapymake/makefile/__init__.py @@ -401,12 +401,6 @@ class CommandLine: file.args.silent or \ file.special_target_has_prereq('.SILENT', current_target.name) - # > If the command prefix contains a , this indicates a makefile command line that shall be executed - # > even if -n, -q, or -t is specified. - should_execute = self.always_execute or not (file.args.dry_run or file.args.question or file.args.touch) - if not should_execute: - return - execution_line = file.expand_macros(self.execution_line, current_target) # > Except as described under the at-sign prefix... @@ -414,6 +408,12 @@ class CommandLine: # > the execution line shall be written to the standard output. print(execution_line) + # > If the command prefix contains a , this indicates a makefile command line that shall be executed + # > even if -n, -q, or -t is specified. + should_execute = self.always_execute or not (file.args.dry_run or file.args.question or file.args.touch) + if not should_execute: + return + # > The execution line shall then be executed by a shell as if it were passed as the argument to the system() # > interface, except that if errors are not being ignored then the shell -e option shall also be in effect. # TODO figure out how to pass -e to the shell reliably @@ -423,6 +423,7 @@ class CommandLine: # > an error message to standard error. if not ignore_errors and result != 0: print('error!', file=sys.stderr) + # TODO implement keep-going sys.exit(1) BUILTIN_INFERENCE_RULES = [ -- cgit v1.2.3