Re: gnulib-tool.py: Refactor directory tree removals

2024-04-13 Thread Bruno Haible
Hi Collin, > > +try: > > +shutil.rmtree(dest) > > +except FileNotFoundError: > > +pass > > You should be able to use 'shutil.rmtree(dest, ignore_errors=True)' > here [1]. Unless you have a reason for not doing so that I missed. It can be useful to get Perm

Re: gnulib-tool.py: Refactor directory tree removals

2024-04-13 Thread Collin Funk
Hi Bruno, On 4/13/24 3:17 AM, Bruno Haible wrote: > +def rmtree(dest: str) -> None: > +'''Removes the file or directory tree at dest, if it exists.''' > +# These two implementations are nearly equivalent. > +# Speed: 'rm -rf' can be a little faster. > +# Exceptions: shutil.rmtree r

gnulib-tool.py: Refactor directory tree removals

2024-04-13 Thread Bruno Haible
There are two ways to remove a directory tree: via 'rm -rf' and through shutil.rmtree. The former is ca. 10% faster on average. Also, it is more likely to include platform-specific optimizations. So, let's use it. 2024-04-13 Bruno Haible gnulib-tool.py: Refactor