-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
48 lines (34 loc) · 1.11 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
import os
import shutil
from glob import glob
from pathlib import Path
import yaml
from invoke import task
REPO = Path(os.path.dirname(__file__))
def get_version():
manifest = (REPO / "extension.yaml").read_text()
return yaml.safe_load(manifest)["Version"]
@task
def build(ctx):
ctx.run("dotnet build src -c Release")
@task
def test(ctx):
ctx.run("dotnet test tests")
@task
def pack(ctx, toolbox="~/AppData/Local/Playnite/Toolbox.exe"):
target = REPO / "dist/raw"
if target.exists():
shutil.rmtree(str(target))
shutil.copytree(str(REPO / "src/bin/Release/net462/"), target)
toolbox = Path(toolbox).expanduser()
ctx.run('"{}" pack "{}" dist'.format(toolbox, target))
for file in glob(str(REPO / "dist/*.pext")):
if "_" in file:
shutil.move(file, str(REPO / "dist/PCGamingWiki_Metadata_Provider_v{}.pext".format(get_version())))
shutil.make_archive(str(REPO / "dist/PCGamingWiki_Metadata_Provider_v{}".format(get_version())), "zip", str(target))
@task
def style(ctx):
ctx.run("dotnet format src")
@task
def clean(ctx):
shutil.rmtree("dist")