@@ -575,15 +575,6 @@ def uniquename(name):
575575 def in_temp (name ):
576576 return os .path .join (temp_dir , os .path .basename (name ))
577577
578- def in_directory (root , child ):
579- # make both path absolute
580- root = os .path .realpath (root )
581- child = os .path .realpath (child )
582-
583- # return true, if the common prefix of both is equal to directory
584- # e.g. /a/b/c/d.rst and directory is /a/b, the common prefix is /a/b
585- return os .path .commonprefix ([root , child ]) == root
586-
587578 # Parses the essential suffix of a filename, discarding Unix-style version numbers in the name. For example for 'libz.so.1.2.8' returns '.so'
588579 def filename_type_suffix (filename ):
589580 for i in reversed (filename .split ('.' )[1 :]):
@@ -2693,6 +2684,15 @@ def is_valid_abspath(options, path_name):
26932684 if shared .path_from_root ().replace ('\\ ' , '/' ) in path_name .replace ('\\ ' , '/' ):
26942685 return True
26952686
2687+ def in_directory (root , child ):
2688+ # make both path absolute
2689+ root = os .path .realpath (root )
2690+ child = os .path .realpath (child )
2691+
2692+ # return true, if the common prefix of both is equal to directory
2693+ # e.g. /a/b/c/d.rst and directory is /a/b, the common prefix is /a/b
2694+ return os .path .commonprefix ([root , child ]) == root
2695+
26962696 for valid_abspath in options .valid_abspaths :
26972697 if in_directory (valid_abspath , path_name ):
26982698 return True
0 commit comments