Commit fad8cf5e authored by Pietro Albini's avatar Pietro Albini

Fix tasks.py due to an Invoke breaking change

parent 81e94384
...@@ -27,6 +27,12 @@ PYTHON = "python3" ...@@ -27,6 +27,12 @@ PYTHON = "python3"
PROJECT = "uitwww" PROJECT = "uitwww"
# This is because invoke can't keep backward compatibility...
_invoke_v = invoke.__version__.split(".")
if int(_invoke_v[0]) == 0 and int(_invoke_v[1]) <= 12:
invoke.task = invoke.ctask
def create_env(name, requirements=False, self=False, force=False): def create_env(name, requirements=False, self=False, force=False):
"""Create a new virtual environment""" """Create a new virtual environment"""
path = os.path.join(BASE, "build", "envs", name) path = os.path.join(BASE, "build", "envs", name)
...@@ -48,7 +54,7 @@ def create_env(name, requirements=False, self=False, force=False): ...@@ -48,7 +54,7 @@ def create_env(name, requirements=False, self=False, force=False):
@invoke.task @invoke.task
def clean(): def clean(ctx):
"""Clean all the build things""" """Clean all the build things"""
for dir in "build", "%s.egg-info" % PROJECT: for dir in "build", "%s.egg-info" % PROJECT:
path = os.path.join(BASE, dir) path = os.path.join(BASE, dir)
...@@ -104,7 +110,7 @@ def clean(): ...@@ -104,7 +110,7 @@ def clean():
@invoke.task @invoke.task
def assets(watch=False): def assets(ctx, watch=False):
"""Build the assets""" """Build the assets"""
node_bin = "%s/node_modules/.bin" % BASE node_bin = "%s/node_modules/.bin" % BASE
...@@ -122,13 +128,13 @@ def assets(watch=False): ...@@ -122,13 +128,13 @@ def assets(watch=False):
@invoke.task(pre=[assets]) @invoke.task(pre=[assets])
def devel(): def devel(ctx):
"""Setup the development environment""" """Setup the development environment"""
create_env("devel", self=True, force=True) create_env("devel", self=True, force=True)
@invoke.task(pre=[assets]) @invoke.task(pre=[assets])
def build(): def build(ctx):
"""Create a new build""" """Create a new build"""
env = create_env("build", requirements=True) env = create_env("build", requirements=True)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment