@@ -157,6 +157,7 @@ def release(session):
157
157
@nox .session (name = "publish-testpypi" )
158
158
def publish_testpypi (session ):
159
159
"""Publish wheelhouse/* to TestPyPI."""
160
+ session .install ("twine" )
160
161
session .run ("twine" , "check" , "build/wheelhouse/*" )
161
162
session .run (
162
163
"twine" ,
@@ -171,6 +172,7 @@ def publish_testpypi(session):
171
172
@nox .session (name = "publish-pypi" )
172
173
def publish_pypi (session ):
173
174
"""Publish wheelhouse/* to PyPI."""
175
+ session .install ("twine" )
174
176
session .run ("twine" , "check" , "build/wheelhouse/*" )
175
177
session .run (
176
178
"twine" ,
@@ -183,15 +185,27 @@ def publish_pypi(session):
183
185
@nox .session (python = False )
184
186
def clean (session ):
185
187
"""Remove all .venv's, build files and caches in the directory."""
188
+ root_folders = (
189
+ [
190
+ "barrier3d.egg-info" ,
191
+ ".pytest_cache" ,
192
+ ".venv" ,
193
+ "build" ,
194
+ "build/wheelhouse" ,
195
+ ]
196
+ if not session .posargs
197
+ else []
198
+ )
199
+
200
+ with session .chdir (ROOT ):
201
+ for folder in root_folders :
202
+ session .log (f"rm -r { folder } " )
203
+ shutil .rmtree (folder , ignore_errors = True )
204
+
186
205
for folder in _args_to_folders (session .posargs ):
187
206
with session .chdir (folder ):
188
- shutil .rmtree ("build" , ignore_errors = True )
189
- shutil .rmtree ("build/wheelhouse" , ignore_errors = True )
190
- shutil .rmtree (f"{ PROJECT } .egg-info" , ignore_errors = True )
191
- shutil .rmtree (".pytest_cache" , ignore_errors = True )
192
- shutil .rmtree (".venv" , ignore_errors = True )
193
-
194
207
for pattern in ["*.py[co]" , "__pycache__" ]:
208
+ session .log (f"rm { pattern } " )
195
209
_clean_rglob (pattern )
196
210
197
211
0 commit comments