a :jg@sfdZddlZddlZddlZddZddZddZd d Zd d Zd dZ e dkrbeej ddS)z9 Functions for converting from DOS to UNIX line endings NcCstj|rt|ddSt|d}|}Wdn1sB0Yd|vrbt|ddStdd|}||krtd|t|d }||Wdn1s0Y|St|d dS) zFReplace CRLF with LF in argument files. Print names of changed files. Directory!NrbBinary!  z dos2unix:wbok ospathisdirprintopenreadresubwritefilefpdatanewdatafrF/usr/local/lib/python3.9/site-packages/numpy/distutils/line_endings.pydos2unix s   &   (rcCs6|D],}tj||}t|}|dur||qdSN)r r joinrappendmodified_filesdir_nameZ file_namesr full_pathrrrdos2unix_one_dirs r$cCsg}tj|t||Sr)r r walkr$r"r!rrr dos2unix_dir%sr'cCstj|rt|ddSt|d}|}Wdn1sB0Yd|vrbt|ddStdd|}tdd|}||krtd|t|d }||Wdn1s0Y|St|d dS) zFReplace LF with CRLF in argument files. Print names of changed files.rNrrrrrz unix2dos:rr r rrrrunix2dos+s    &   (r(cCs6|D],}tj||}t||dur||qdSr)r r rr(rr rrrunix2dos_one_dir@s r)cCsg}tj|t||Sr)r r r%r)r&rrr unix2dos_dirGsr*__main__) __doc__r rsysrr$r'r(r)r*__name__argvrrrrs