@@ -121,7 +121,9 @@ def arg_parser():
121
121
exgroup .add_argument ("--debug" , action = "store_true" , help = "Print even more logging" )
122
122
123
123
parser .add_argument ("--tool-help" , action = "store_true" , help = "Print command line help for tool" )
124
- parser .add_argument ("--relative-deps" , action = "store_true" , help = "When using --print-deps, print relative paths to dependencies." )
124
+
125
+ parser .add_argument ("--relative-deps" , choices = ['primary' , 'cwd' ], default = "primary" ,
126
+ help = "When using --print-deps, print paths relative to primary file or current working directory." )
125
127
126
128
parser .add_argument ("--enable-net" , action = "store_true" , help = "Use docker's default network for container, default to disable network" )
127
129
@@ -462,13 +464,17 @@ def loadref(b, u):
462
464
deps ["secondaryFiles" ] = sf
463
465
464
466
if relative_deps :
465
- base = basedir if basedir else os .path .dirname (obj ["id" ])
467
+ if relative_deps == "primary" :
468
+ base = basedir if basedir else os .path .dirname (obj ["id" ])
469
+ elif relative_deps == "cwd" :
470
+ base = "file://" + os .getcwd ()
471
+ else :
472
+ raise Exception ("Unknown relative_deps %s" % relative_deps )
466
473
def makeRelative (u ):
467
474
if ":" in u .split ("/" )[0 ] and not u .startswith ("file://" ):
468
475
return u
469
476
return os .path .relpath (u , base )
470
- process .adjustFiles (sf , makeRelative )
471
- deps ["path" ] = os .path .basename (deps ["path" ])
477
+ process .adjustFiles (deps , makeRelative )
472
478
473
479
stdout .write (json .dumps (deps , indent = 4 ))
474
480
0 commit comments