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
|
# -*- encoding: ascii -*-
"""
Dependencies
~~~~~~~~~~~~
"""
import os as _os
import invoke as _invoke
@_invoke.task()
def old(ctx):
""" List outdated python packages """
with ctx.shell.root_dir():
ctx.run('pip list -o', echo=True)
@_invoke.task()
def package(ctx, upgrade=False):
""" Update python dependencies, excluding development """
with ctx.shell.root_dir():
ctx.run('pip install %s-e .' % ('-U ' if upgrade else '',), echo=True)
@_invoke.task(default=True)
def dev(ctx, upgrade=False):
""" Update python dependencies, including development """
with ctx.shell.root_dir():
ctx.run('pip install %s-r development.txt'
% ('-U ' if upgrade else '',), echo=True)
@_invoke.task()
def reset(ctx, python=False, upgrade=False):
""" Reset your virtual env """
cmd = "bash -il %s/reset.sh"
if python:
cmd += ' -p'
if upgrade:
cmd += ' -u'
cmd += ' %s'
with ctx.shell.root_dir():
pwd = _os.getcwd()
ctx.run(ctx.c(cmd, ctx.shell.native(_os.path.dirname(__file__)), pwd),
pty=True)
|