Skip to content

Commit

Permalink
Make invoke clean-all task delete worker/include/FBS (#1397)
Browse files Browse the repository at this point in the history
- `worker/fbs/meson.build` produces FlatBuffers C++ include files in `worker/include/FBS` folder.
- Despite such a folder is gitignored, `cargo publish` complains if that folder and its files exist.
- So make `invoke clean-all` also delete `worker/include/FBS`.
- Bonus track: Use `shutil.rmtree(path, ignore_errors=True)` instead of wrapping it with `try/except` everywhere.
  • Loading branch information
ibc authored May 10, 2024
1 parent c6aa049 commit 7db7e36
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions worker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,37 +170,24 @@ def clean(ctx): # pylint: disable=unused-argument
"""
Clean the installation directory
"""
try:
shutil.rmtree(MEDIASOUP_INSTALL_DIR);
except:
pass;
shutil.rmtree(MEDIASOUP_INSTALL_DIR, ignore_errors=True);


@task
def clean_build(ctx): # pylint: disable=unused-argument
"""
Clean the build directory
"""
try:
shutil.rmtree(BUILD_DIR);
except:
pass;
shutil.rmtree(BUILD_DIR, ignore_errors=True);


@task
def clean_pip(ctx): # pylint: disable=unused-argument
"""
Clean the local pip setup
"""
try:
shutil.rmtree(PIP_MESON_NINJA_DIR);
except:
pass;

try:
shutil.rmtree(PIP_PYLINT_DIR);
except:
pass;
shutil.rmtree(PIP_MESON_NINJA_DIR, ignore_errors=True);
shutil.rmtree(PIP_PYLINT_DIR, ignore_errors=True);


@task(pre=[meson_ninja])
Expand Down Expand Up @@ -233,10 +220,8 @@ def clean_all(ctx):
except:
pass;

try:
shutil.rmtree(MEDIASOUP_OUT_DIR);
except:
pass;
shutil.rmtree(MEDIASOUP_OUT_DIR, ignore_errors=True);
shutil.rmtree('include/FBS', ignore_errors=True);


@task(pre=[meson_ninja])
Expand Down

0 comments on commit 7db7e36

Please sign in to comment.