@@ -94,6 +94,10 @@ class SubTask:
9494 _drivers = ['trDynaPS' , 'DynaPS' , 'CM' , 'EPS' ]
9595 _driver_map = {(i + 1 ): x for i , x in enumerate (_drivers )}
9696
97+ @classmethod
98+ def adjust_args (cls , args ):
99+ pass
100+
97101 def __init__ (self , args , dont_cleanup = False , ** kwargs ):
98102 self .current_args = args
99103 self .dont_cleanup = dont_cleanup
@@ -104,10 +108,6 @@ def __init__(self, args, dont_cleanup=False, **kwargs):
104108 def __del__ (self ):
105109 self .cleanup_files ()
106110
107- @classmethod
108- def adjust_args (cls , args ):
109- pass
110-
111111 def cleanup_files (self ):
112112 if self .dont_cleanup or self .current_args .dont_cleanup :
113113 return
@@ -170,29 +170,40 @@ def run_commands(self, args, cmds=None, output_file=None, **kwargs):
170170
171171class BuildSubTask (SubTask ):
172172
173+ @classmethod
174+ def adjust_args (cls , args ):
175+ cls .prefix_path_args (args , ['build_dir' , 'install_dir' ])
176+ super (BuildSubTask , cls ).adjust_args (args )
177+
173178 def __init__ (self , args , config_args = None , build_args = None ,
174179 install_args = None , build_kwargs = None , build_env = None ,
175180 ** kwargs ):
176181 self .adjust_args (args )
182+ kwargs .setdefault ('cwd' , args .build_dir )
183+ super (BuildSubTask , self ).__init__ (args , ** kwargs )
184+
185+ def run_commands (self , args , config_args = None , build_args = None ,
186+ install_args = None , build_kwargs = None , build_env = None ,
187+ ** kwargs ):
177188 if build_kwargs is None :
178189 build_kwargs = {}
179190 build_kwargs .setdefault ('env' , build_env )
180191 if not args .dont_build :
181192 build (args , config_args = config_args , build_args = build_args ,
182193 install_args = install_args , ** build_kwargs )
183- kwargs .setdefault ('cwd' , args .build_dir )
184- super (BuildSubTask , self ).__init__ (args , ** kwargs )
185-
186- @classmethod
187- def adjust_args (cls , args ):
188- cls .prefix_path_args (args , ['build_dir' , 'install_dir' ])
194+ super (BuildSubTask , self ).run_commands (args , ** kwargs )
189195
190196
191197class build (SubTask ):
192198
199+ @classmethod
200+ def adjust_args (cls , args ):
201+ BuildSubTask .adjust_args (args )
202+ super (build , cls ).adjust_args (args )
203+
193204 def __init__ (self , args , config_args = None , build_args = None ,
194205 install_args = None , ** kwargs ):
195- BuildSubTask .adjust_args (args )
206+ self .adjust_args (args )
196207 if config_args is None :
197208 config_args = []
198209 if build_args is None :
@@ -287,6 +298,12 @@ def __init__(self, args):
287298
288299class test (BuildSubTask ):
289300
301+ @classmethod
302+ def adjust_args (cls , args ):
303+ if args .refresh_output :
304+ args .preserve_output = True
305+ super (test , cls ).adjust_args (args )
306+
290307 def __init__ (self , args , test_flags = None ,
291308 config_args = None , build_args = None , ** kwargs ):
292309 self .adjust_args (args )
@@ -348,12 +365,6 @@ def __init__(self, args, test_flags=None,
348365 else :
349366 print (f"MISSING OUTPUT { fsrc } " )
350367
351- @classmethod
352- def adjust_args (cls , args ):
353- if args .refresh_output :
354- args .preserve_output = True
355- super (test , cls ).adjust_args (args )
356-
357368
358369class ephoto (BuildSubTask ):
359370
@@ -408,21 +419,6 @@ def iter_drivers(cls, func, args, suffix_paths=None, **kwargs):
408419
409420class compare_matlab (BuildSubTask ):
410421
411- def __init__ (self , args , config_args = None , build_args = None ):
412- self .adjust_args (args )
413- if config_args is None :
414- config_args = []
415- if build_args is None :
416- build_args = []
417- cmds = []
418- super (compare_matlab , self ).__init__ (
419- args , cmds = cmds , config_args = config_args ,
420- build_args = build_args , cwd = _source_dir ,
421- )
422- args .rebuild = False
423- args .dont_build = True
424- self .compare (args )
425-
426422 @classmethod
427423 def adjust_args (cls , args ):
428424 args .make_equivalent_to_matlab = True
@@ -450,6 +446,21 @@ def adjust_args(cls, args):
450446 if not os .path .isdir (args .matlab_output_dir ):
451447 os .mkdir (args .matlab_output_dir )
452448
449+ def __init__ (self , args , config_args = None , build_args = None ):
450+ self .adjust_args (args )
451+ if config_args is None :
452+ config_args = []
453+ if build_args is None :
454+ build_args = []
455+ cmds = []
456+ super (compare_matlab , self ).__init__ (
457+ args , cmds = cmds , config_args = config_args ,
458+ build_args = build_args , cwd = _source_dir ,
459+ )
460+ args .rebuild = False
461+ args .dont_build = True
462+ self .compare (args )
463+
453464 def compare (self , args ):
454465 if args .driver == 0 :
455466 ephoto .iter_drivers (
@@ -612,6 +623,15 @@ def check_output(cls, f1, f2, reltol=1.0e-05, abstol=1.0e-08):
612623
613624class docs (BuildSubTask ):
614625
626+ @classmethod
627+ def adjust_args (cls , args ):
628+ args .with_asan = False
629+ args .build_type = 'Debug'
630+ args .dont_build = False
631+ args .dont_install = True
632+ args .only_python = False
633+ super (docs , cls ).adjust_args (args )
634+
615635 def __init__ (self , args , config_args = None , build_args = None ,
616636 install_args = None ):
617637 self .adjust_args (args )
@@ -630,15 +650,6 @@ def __init__(self, args, config_args=None, build_args=None,
630650 install_args = install_args ,
631651 )
632652
633- @classmethod
634- def adjust_args (cls , args ):
635- args .with_asan = False
636- args .build_type = 'Debug'
637- args .dont_build = False
638- args .dont_install = True
639- args .only_python = False
640- super (docs , cls ).adjust_args (args )
641-
642653
643654class coverage (BuildSubTask ):
644655
0 commit comments