forked from CalumJEadie/microbuild
-
Notifications
You must be signed in to change notification settings - Fork 18
/
example.py
executable file
·53 lines (41 loc) · 1.26 KB
/
example.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
#!/usr/bin/python
from pynt import task
@task()
def clean():
'''Clean build directory.'''
print('Cleaning build directory...')
@task()
def _copy_resources():
'''Copy resource files.'''
print('Copying resource files')
@task(clean, _copy_resources)
def html(target='.'):
'''Generate HTML.'''
print(('Generating HTML in directory "%s"' % target))
@task(clean, _copy_resources, ignore=True)
def images():
'''Prepare images.'''
print('Preparing images...')
@task(html,images)
def start_server(server='localhost', port = '80'):
'''Start the server'''
print(('Starting server at %s:%s' % (server, port)))
@task(start_server) #Depends on task with all optional params
def stop_server():
print('Stopping server....')
@task()
def copy_file(src, dest):
print(('Copying from %s to %s' % (src, dest)))
@task()
def echo(*args,**kwargs):
print(args)
print(kwargs)
@task()
def error_task():
print("this should fail with an error")
raise IOError
# Default task (if specified) is run when no task is specified in the command line
# make sure you define the variable __DEFAULT__ after the task is defined
# A good convention is to define it at the end of the module
# __DEFAULT__ is an optional member
__DEFAULT__=start_server