-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpie_tasks.py
56 lines (42 loc) · 1.35 KB
/
pie_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
import os
from pie import *
# Get OS-specific partial path
VENV_BUILD = os.path.join(".venvs", "build")
VENV_TEST = os.path.join(".venvs", "test")
@task
def build():
with venv(VENV_BUILD):
cmd(r"python setup.py bdist_wheel clean --all")
@task
def createVenvs():
venv(VENV_BUILD).create()
venv(VENV_TEST).create()
@task
def setup():
createVenvs()
updatePackages()
@task([OptionsParameter('filter', use_default=True)])
def test(filter=None):
with venv(VENV_TEST):
if not filter:
cmd("python -c \"import pytest; pytest.main(['-s', '--cov', 'agsconfig', 'tests']);\"")
else:
cmd(
"python -c \"import pytest; pytest.main(['-s', '--cov', 'agsconfig', 'tests', '-k', '{}']);\"".format(
filter.replace("'", "\\'")
)
)
@task
def updatePackages():
with venv(VENV_BUILD):
pip(r"install -U pip")
pip(r"install -U -r requirements.build.txt")
pip(r"install -U -r requirements.txt")
with venv(VENV_TEST):
pip(r"install -U pip")
pip(r"install -U -r requirements.test.txt")
pip(r"install -U -r requirements.txt")
@task([OptionsParameter('version')])
def upload(version):
with venv(VENV_BUILD):
cmd(r'python -m twine upload dist\agsconfig-{}-py2.py3-none-any.whl'.format(version))