Debian Codegraph @

doc/samples/initial_workdir.py

raw symbols SCIP
1 ### README
2 # Sample to test doit.get_initial_workdir
3 # First create a folder named 'sub1'.
4 # Invoking doit from the root folder will execute both tasks 'base' and 'sub1'.
5 # Invoking 'doit -k' from path 'sub1' will execute only task 'sub1'
6 ##################
7
8 import os
9
10 import doit
11
12 DOIT_CONFIG = {
13 'verbosity': 2,
14 'default_tasks': None, # all by default
15 }
16
17
18 # change default tasks based on dir from where doit was run
19 sub1_dir = os.path.join(os.path.dirname(__file__), 'sub1')
20 if doit.get_initial_workdir() == sub1_dir:
21 DOIT_CONFIG['default_tasks'] = ['sub1']
22
23
24 def task_base():
25 return {'actions': ['echo root']}
26
27 def task_sub1():
28 return {'actions': ['echo sub1']}