Skip to content

Commit 38ee9f0

Browse files
committed
Abstracted clean.py
1 parent 1bbc39b commit 38ee9f0

4 files changed

Lines changed: 16 additions & 14 deletions

File tree

remove-json-keys/noxfile.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import shutil
2-
from pathlib import Path
31
import nox
42

53
def session(func) : return nox.session(venv_backend='none')(func)
@@ -26,8 +24,4 @@ def deploy_minor(session) : bump_minor(session) ; build(session) ; publish(sessi
2624
def deploy_major(session) : bump_major(session) ; build(session) ; publish(session)
2725

2826
@session
29-
def clean(session):
30-
for target in ['dist', 'build', '*_cache', '__pycache__', '*.egg-info']:
31-
for path in Path('.').rglob(target):
32-
if path.is_dir() : shutil.rmtree(path) ; print(f'Removed {path}/')
33-
print('Clean complete!')
27+
def clean(session) : session.run('python', 'utils/clean.py')

remove-json-keys/utils/clean.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from pathlib import Path
2+
import shutil
3+
4+
for target in ['dist', 'build', '*_cache', '__pycache__', '*.egg-info']:
5+
for path in Path('.').rglob(target):
6+
if path.is_dir() : shutil.rmtree(path) ; print(f'Removed {path}/')
7+
print('Clean complete!')

translate-messages/noxfile.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import shutil
2-
from pathlib import Path
31
import nox
42

53
def session(func) : return nox.session(venv_backend='none')(func)
@@ -26,8 +24,4 @@ def deploy_minor(session) : bump_minor(session) ; build(session) ; publish(sessi
2624
def deploy_major(session) : bump_major(session) ; build(session) ; publish(session)
2725

2826
@session
29-
def clean(session):
30-
for target in ['dist', 'build', '*_cache', '__pycache__', '*.egg-info']:
31-
for path in Path('.').rglob(target):
32-
if path.is_dir() : shutil.rmtree(path) ; print(f'Removed {path}/')
33-
print('Clean complete!')
27+
def clean(session) : session.run('python', 'utils/clean.py')

translate-messages/utils/clean.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from pathlib import Path
2+
import shutil
3+
4+
for target in ['dist', 'build', '*_cache', '__pycache__', '*.egg-info']:
5+
for path in Path('.').rglob(target):
6+
if path.is_dir() : shutil.rmtree(path) ; print(f'Removed {path}/')
7+
print('Clean complete!')

0 commit comments

Comments
 (0)