from pant.pant import ant, target
"""
Define targets using 'target' decorator
"""

"""
A decorator call without arguments uses function name is as target name
and docstring as target description
"""
@target
def ptarget1():
    """Python project ptarget1"""
    ant.echo("echo ptarget1")

"""
Decorator also takes keyword arguments that match Ant 'target' attributes
Name and description default to function name and docstring or can be provided explicitly
'depends' could contain a string with the list of targets or point to a function
"""
@target(depends=ptarget1)
def ptarget2():
    """Python project ptarget2"""
    ant.echo("echo ptarget2")

"""
All targets are created using the name of the module ('python_ant_project') as Ant project name
unless you override it using 'project_name' argument.
You can see a target's project name by running 'ant -p'  
"""
@target(depends="init, ptarget1, ptarget2", name="p.target3", if_="lib.dir", project_name="python.project")
def p_target3():
    """Python project p.target3"""
    ant.echo("echo p.target3")


# Note the decorator won't work for methods, since it doesn't know how to instantiate a class 
