@@ -398,6 +398,7 @@ def init_job_order(
398398 input_basedir : str = "" ,
399399 secret_store : Optional [SecretStore ] = None ,
400400 input_required : bool = True ,
401+ runtime_context : Optional [RuntimeContext ] = None ,
401402) -> CWLObjectType :
402403 secrets_req , _ = process .get_requirement ("http://commonwl.org/cwltool#Secrets" )
403404 if job_order_object is None :
@@ -472,23 +473,6 @@ def init_job_order(
472473 else :
473474 job_order_object = {}
474475
475- if print_input_deps :
476- basedir = None # type: Optional[str]
477- uri = cast (str , job_order_object ["id" ])
478- if uri == args .workflow :
479- basedir = os .path .dirname (uri )
480- uri = ""
481- printdeps (
482- job_order_object ,
483- loader ,
484- stdout ,
485- relative_deps ,
486- uri ,
487- basedir = basedir ,
488- nestdirs = False ,
489- )
490- exit (0 )
491-
492476 def path_to_loc (p : CWLObjectType ) -> None :
493477 if "location" not in p and "path" in p :
494478 p ["location" ] = p ["path" ]
@@ -513,6 +497,31 @@ def expand_formats(p: CWLObjectType) -> None:
513497 adjustDirObjs (job_order_object , trim_listing )
514498 normalizeFilesDirs (job_order_object )
515499
500+ if print_input_deps :
501+ if not runtime_context :
502+ raise RuntimeError ("runtime_context is required for print_input_deps." )
503+ runtime_context .toplevel = True
504+ builder = process ._init_job (job_order_object , runtime_context )
505+ builder .loadListing = "no_listing"
506+ builder .bind_input (
507+ process .inputs_record_schema , job_order_object , discover_secondaryFiles = True
508+ )
509+ basedir : Optional [str ] = None
510+ uri = cast (str , job_order_object ["id" ])
511+ if uri == args .workflow :
512+ basedir = os .path .dirname (uri )
513+ uri = ""
514+ printdeps (
515+ job_order_object ,
516+ loader ,
517+ stdout ,
518+ relative_deps ,
519+ uri ,
520+ basedir = basedir ,
521+ nestdirs = False ,
522+ )
523+ exit (0 )
524+
516525 if secret_store and secrets_req :
517526 secret_store .store (
518527 [shortname (sc ) for sc in cast (List [str ], secrets_req ["secrets" ])],
@@ -1266,6 +1275,7 @@ def main(
12661275 input_basedir = input_basedir ,
12671276 secret_store = runtimeContext .secret_store ,
12681277 input_required = input_required ,
1278+ runtime_context = runtimeContext ,
12691279 )
12701280 except SystemExit as err :
12711281 return err .code
0 commit comments