Skip to content
This repository was archived by the owner on Oct 20, 2018. It is now read-only.

Commit b45effe

Browse files
committed
Update tasks
1 parent aecbdca commit b45effe

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

tasks.py

+28-19
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,33 @@
22

33
"""Useful task commands for development and maintenance."""
44

5+
import glob
6+
import os
7+
import shutil
8+
59
from invoke import run, task
610

11+
to_remove_dirnames = ['**/__pycache__', '.cache', '.tox', 'build', 'dist', 'gmusicapi_scripts.egg-info']
12+
to_remove_filenames = ['**/*.pyc', '**/*.pyo', '.coverage']
13+
714

815
@task
916
def clean():
1017
"""Clean the project directory of unwanted files and directories."""
1118

12-
run('rm -rf gmusicapi_scripts.egg-info')
13-
run('rm -rf .coverage')
14-
run('rm -rf .tox')
15-
run('rm -rf .cache')
16-
run('rm -rf build/')
17-
run('rm -rf dist/')
18-
run('rm -rf site/')
19-
run('find . -name *.pyc -delete')
20-
run('find . -name *.pyo -delete')
21-
run('find . -name __pycache__ -delete -depth')
22-
run('find . -name *~ -delete')
19+
to_remove_dirs = [
20+
path for dirname in to_remove_dirnames for path in glob.glob(dirname) if os.path.isdir(path)
21+
]
22+
23+
for dirpath in to_remove_dirs:
24+
shutil.rmtree(dirpath)
25+
26+
to_remove_files = [
27+
path for filename in to_remove_filenames for path in glob.glob(filename) if os.path.isfile(path)
28+
]
29+
30+
for filepath in to_remove_files:
31+
os.remove(filepath)
2332

2433

2534
@task(clean)
@@ -30,12 +39,19 @@ def build():
3039

3140

3241
@task(build)
33-
def deploy():
42+
def publish():
3443
"""Build and upload gmusicapi_scripts distributions."""
3544

3645
upload()
3746

3847

48+
@task
49+
def upload():
50+
"""Upload gmusicapi_scripts distributions using twine."""
51+
52+
run('twine upload dist/*')
53+
54+
3955
@task
4056
def docs(test=False):
4157
""""Build the gmusicapi_scripts docs."""
@@ -44,10 +60,3 @@ def docs(test=False):
4460
run('mkdocs serve')
4561
else:
4662
run('mkdocs gh-deploy --clean')
47-
48-
49-
@task
50-
def upload():
51-
"""Upload gmusicapi_scripts distributions using twine."""
52-
53-
run('twine upload dist/*')

0 commit comments

Comments
 (0)