Add a release_clean nox target
Add a way to remove the 'dist' directory, removing all artifacts from a
previous build.
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause
import glob
+import shutil
import sys
from contextlib import suppress
from pathlib import Path
@@ -270,6 +271,7 @@ def dev_coverage_report(session: nox.Session) -> None:
#
# Release pipeline.
#
+# - Clean out the dist directory.
# - Build wheels (release builds).
# - Install cocotb from wheel.
# - Run tests against cocotb installed from the wheel.
@@ -281,6 +283,12 @@ def dev_coverage_report(session: nox.Session) -> None:
dist_dir = "dist"
+@nox.session
+def release_clean(session: nox.Session) -> None:
+ """Remove all build artifacts from the dist directory."""
+ shutil.rmtree(dist_dir, ignore_errors=True)
+
+
@nox.session
def release_build(session: nox.Session) -> None:
"""Build a release (sdist and bdist)."""
