diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-12-19 11:03:34 -0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2018-12-20 13:30:30 -0500 |
commit | f9a35e08acd34173355fbaea391045373d931abb (patch) | |
tree | e61e5297ae6a1645b8b7129d3d05c60e6a714fdf /mesonbuild/mesonlib.py | |
parent | 7838f9afc390a53d4097f3710b9f30cb52031be9 (diff) | |
download | meson-f9a35e08acd34173355fbaea391045373d931abb.zip meson-f9a35e08acd34173355fbaea391045373d931abb.tar.gz meson-f9a35e08acd34173355fbaea391045373d931abb.tar.bz2 |
msetup: Fix callig meson --wipe inside a build directory
This seems to be related to deleting the current working directory.
Simply deleting all of the trees inside the build directory instead
seems to fix it. This only appears with some combination of generated
targets, running the test case against say "1 trivial" doesn't show the
bug.
See this mesa bug: https://bugs.freedesktop.org/show_bug.cgi?id=109071
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 59d4f81..98c2366 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -1116,6 +1116,22 @@ def windows_proof_rmtree(f): shutil.rmtree(f) +def windows_proof_rm(fpath): + """Like windows_proof_rmtree, but for a single file.""" + if os.path.isfile(fpath): + os.chmod(fpath, os.stat(fpath).st_mode | stat.S_IWRITE | stat.S_IREAD) + delays = [0.1, 0.1, 0.2, 0.2, 0.2, 0.5, 0.5, 1, 1, 1, 1, 2] + for d in delays: + try: + os.unlink(fpath) + return + except FileNotFoundError: + return + except (OSError, PermissionError): + time.sleep(d) + os.unlink(fpath) + + def detect_subprojects(spdir_name, current_dir='', result=None): if result is None: result = {} |