@@ -173,6 +173,11 @@ def compile_file(fullname, ddir=None, force=False, rx=None, quiet=0,
173173 limit_sl_dest: ignore symlinks if they are pointing outside of
174174 the defined path.
175175 """
176+
177+ if ddir is not None and (stripdir is not None or prependdir is not None ):
178+ raise ValueError (("Destination dir (ddir) cannot be used "
179+ "in combination with stripdir or prependdir" ))
180+
176181 success = True
177182 if PY36 and quiet < 2 and isinstance (fullname , os .PathLike ):
178183 fullname = os .fspath (fullname )
@@ -349,16 +354,16 @@ def main():
349354 default = None ,
350355 help = ('part of path to left-strip from path '
351356 'to source file - for example buildroot. '
352- 'if `-d` and `-s` options are specified, '
353- 'then `-d` takes precedence .' ))
357+ '`-d` and `-s` options cannot be '
358+ 'specified together .' ))
354359 parser .add_argument ('-p' , metavar = 'PREPENDDIR' , dest = 'prependdir' ,
355360 default = None ,
356361 help = ('path to add as prefix to path '
357362 'to source file - for example / to make '
358363 'it absolute when some part is removed '
359- 'by `-s` option'
360- 'if `-d` and `-a ` options are specified, '
361- 'then `-d` takes precedence .' ))
364+ 'by `-s` option. '
365+ '`-d` and `-p ` options cannot be '
366+ 'specified together .' ))
362367 parser .add_argument ('-x' , metavar = 'REGEXP' , dest = 'rx' , default = None ,
363368 help = ('skip files matching the regular expression; '
364369 'the regexp is searched for in the full path '
@@ -408,6 +413,11 @@ def main():
408413 if args .opt_levels is None :
409414 args .opt_levels = [- 1 ]
410415
416+ if args .ddir is not None and (
417+ args .stripdir is not None or args .prependdir is not None
418+ ):
419+ parser .error ("-d cannot be used in combination with -s or -p" )
420+
411421 # if flist is provided then load it
412422 if args .flist :
413423 try :
0 commit comments