-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
tasks.py
57 lines (47 loc) · 1.21 KB
/
tasks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import shlex
import shutil
from pathlib import Path
from invoke import task
ROOT = Path(__file__).parent
def get_version() -> str:
for line in (ROOT / "pyproject.toml").read_text("utf-8").splitlines():
if line.startswith("version ="):
return line.replace("version = ", "").strip('"')
return "0.0.0"
@task
def install(ctx):
ctx.run("pip uninstall -y dunamai")
shutil.rmtree("dist", ignore_errors=True)
ctx.run("poetry build")
wheel = next(ROOT.glob("dist/*.whl"))
ctx.run('pip install "{}"'.format(wheel))
@task
def docs(ctx):
version = get_version()
manpage = "docs/dunamai.1"
args = [
"poetry",
"run",
"argparse-manpage",
"--pyfile",
"dunamai/__main__.py",
"--function",
"get_parser",
"--project-name",
"dunamai",
"--prog",
"dunamai",
"--version",
version,
"--author",
'"Matthew T. Kennerly (mtkennerly)"',
"--url",
"https://github.com/mtkennerly/dunamai",
"--format",
"single-commands-section",
"--output",
manpage,
"--manual-title",
"Dunamai",
]
ctx.run(shlex.join(args))