/usr/share/doc/python-doit-doc/examples/tutorial/initial_workdir.py is in python-doit-doc 0.25.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | ### README
# Sample to test doit.get_initial_workdir
# First create a folder named 'sub1'.
# Invoking doit from the root folder will execute both tasks 'base' and 'sub1'.
# Invoking 'doit -k' from path 'sub1' will execute only task 'sub1'
##################
import os
import doit
DOIT_CONFIG = {
'verbosity': 2,
'default_tasks': None, # all by default
}
# change default tasks based on dir from where doit was run
sub1_dir = os.path.join(os.path.dirname(__file__), 'sub1')
if doit.get_initial_workdir() == sub1_dir:
DOIT_CONFIG['default_tasks'] = ['sub1']
def task_base():
return {'actions': ['echo root']}
def task_sub1():
return {'actions': ['echo sub1']}
|