File tree Expand file tree Collapse file tree 2 files changed +29
-7
lines changed
Expand file tree Collapse file tree 2 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -69,18 +69,16 @@ commands = pyright src/ {posargs}
6969# readthedocs doc build
7070basepython = python3.11
7171deps = -r requirements/py{py_dot_ver}/docs.txt
72- allowlist_externals = rm
73- changedir = docs/
7472# clean the build dir before rebuilding
75- commands_pre = rm -rf _build/
73+ globus_sdk_rmtree = docs/_build
74+ changedir = docs/
7675commands = sphinx-build -j auto -d _build/doctrees -b html -W . _build/html {posargs}
7776
7877[testenv:twine-check]
7978skip_install = true
8079deps = build
8180 twine!=5.1.0
82- allowlist_externals = rm
83- commands_pre = rm -rf dist/
81+ globus_sdk_rmtree = dist
8482# check that twine validating package data works
8583commands = python -m build
8684 twine check --strict dist/*
@@ -89,8 +87,7 @@ commands = python -m build
8987skip_install = true
9088deps = poetry
9189# remove the dist dir because it can lead to (confusing) spurious failures
92- allowlist_externals = rm
93- commands_pre = rm -rf dist/
90+ globus_sdk_rmtree = dist
9491# use `poetry lock` to ensure that poetry can parse our dependencies
9592changedir = tests/non-pytest/poetry-lock-test
9693commands = poetry lock
Original file line number Diff line number Diff line change 1111
1212from __future__ import annotations
1313
14+ import logging
1415import pathlib
1516import shutil
1617import typing as t
1718
1819from tox .plugin import impl
1920
2021if t .TYPE_CHECKING :
22+ from tox .config .sets import EnvConfigSet
23+ from tox .session .state import State
2124 from tox .tox_env .api import ToxEnv
2225
26+ log = logging .getLogger (__name__ )
27+
2328REPO_ROOT = pathlib .Path (__file__ ).parent
2429BUILD_DIR = REPO_ROOT / "build"
2530
@@ -33,3 +38,23 @@ def tox_on_install(
3338 return
3439 if BUILD_DIR .exists ():
3540 shutil .rmtree (BUILD_DIR )
41+
42+
43+ @impl
44+ def tox_add_env_config (env_conf : EnvConfigSet , state : State ) -> None :
45+ env_conf .add_config (
46+ keys = ["globus_sdk_rmtree" ],
47+ of_type = list [str ],
48+ default = [],
49+ desc = "A dir tree to remove before running the environment commands" ,
50+ )
51+
52+
53+ @impl
54+ def tox_before_run_commands (tox_env : ToxEnv ) -> None :
55+ sdk_rmtree = tox_env .conf .load ("globus_sdk_rmtree" )
56+ for name in sdk_rmtree :
57+ path = pathlib .Path (name )
58+ if path .exists ():
59+ log .warning (f"globus_sdk_rmtree: { path } " )
60+ shutil .rmtree (path )
You can’t perform that action at this time.
0 commit comments