@@ -398,6 +398,7 @@ def init_job_order(
398
398
input_basedir : str = "" ,
399
399
secret_store : Optional [SecretStore ] = None ,
400
400
input_required : bool = True ,
401
+ runtime_context : Optional [RuntimeContext ] = None ,
401
402
) -> CWLObjectType :
402
403
secrets_req , _ = process .get_requirement ("http://commonwl.org/cwltool#Secrets" )
403
404
if job_order_object is None :
@@ -472,23 +473,6 @@ def init_job_order(
472
473
else :
473
474
job_order_object = {}
474
475
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
-
492
476
def path_to_loc (p : CWLObjectType ) -> None :
493
477
if "location" not in p and "path" in p :
494
478
p ["location" ] = p ["path" ]
@@ -513,6 +497,31 @@ def expand_formats(p: CWLObjectType) -> None:
513
497
adjustDirObjs (job_order_object , trim_listing )
514
498
normalizeFilesDirs (job_order_object )
515
499
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
+
516
525
if secret_store and secrets_req :
517
526
secret_store .store (
518
527
[shortname (sc ) for sc in cast (List [str ], secrets_req ["secrets" ])],
@@ -1266,6 +1275,7 @@ def main(
1266
1275
input_basedir = input_basedir ,
1267
1276
secret_store = runtimeContext .secret_store ,
1268
1277
input_required = input_required ,
1278
+ runtime_context = runtimeContext ,
1269
1279
)
1270
1280
except SystemExit as err :
1271
1281
return err .code
0 commit comments