Skip to content

Commit

Permalink
Merge 0b38b06 into 7af7f93
Browse files Browse the repository at this point in the history
  • Loading branch information
noisecapella committed Feb 2, 2015
2 parents 7af7f93 + 0b38b06 commit c7bfa65
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 62 deletions.
29 changes: 19 additions & 10 deletions doit/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,23 @@ class CmdAction(BaseAction):
"""
Command line action. Spawns a new process.
@ivar action(str,list,callable): subprocess command string or string list,
@ivar action: subprocess command string or string list,
see subprocess.Popen first argument.
It may also be a callable that generates the command string.
Strings may contain python mappings with the keys: dependencies,
changed and targets. ie. "zip %(targets)s %(changed)s"
@ivar task(Task): reference to task that contains this action
@ivar save_out: (str) name used to save output in `values`
@type action: (str,list,callable)
@ivar task: reference to task that contains this action
@type task: L{Task}
@ivar save_out: name used to save output in `values`
@type save_out: str
@ivar shell: use shell to execute command
see subprocess.Popen `shell` attribute
@ivar encoding (str): encoding of the process output
@ivar decode_error (str): value for decode() `errors` param
while decoding process output
@ivar encoding: encoding of the process output
@type encoding: str
@ivar decode_error: value for decode() `errors` param
while decoding process output
@type decode_error: str
@ivar pkwargs: Popen arguments except 'stdout' and 'stderr'
"""

Expand Down Expand Up @@ -290,10 +295,14 @@ def isatty(self):
class PythonAction(BaseAction):
"""Python action. Execute a python callable.
@ivar py_callable: (callable) Python callable
@ivar args: (sequence) Extra arguments to be passed to py_callable
@ivar kwargs: (dict) Extra keyword arguments to be passed to py_callable
@ivar task(Task): reference to task that contains this action
@ivar py_callable: Python callable
@type py_callable: callable
@ivar args: Extra arguments to be passed to py_callable
@type args: sequence
@ivar kwargs: Extra keyword arguments to be passed to py_callable
@type kwargs: dict
@ivar task: reference to task that contains this action
@type task: L{Task}
"""
def __init__(self, py_callable, args=None, kwargs=None, task=None):
#pylint: disable=W0231
Expand Down
19 changes: 12 additions & 7 deletions doit/cmd_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,18 @@ def clean_tasks(self, tasks, dryrun):
def _execute(self, dryrun, cleandep, cleanall, pos_args=None):
"""Clean tasks
@param task_list (list - L{Task}): list of all tasks from dodo file
@ivar dryrun (bool): if True clean tasks are not executed
(just print out what would be executed)
@param cleandep (bool): execute clean from task_dep
@param cleanall (bool): clean all tasks
@var default_tasks (list - string): list of default tasks
@var selected_tasks (list - string): list of tasks selected
from cmd-line
@param dryrun: if True clean tasks are not executed
(just print out what would be executed)
@param dryrun: bool
@param cleandep: execute clean from task_dep
@type cleandep: bool
@param cleanall: clean all tasks
@type cleanall: bool
@var default_tasks: list of default tasks
@type default_tasks: list - str
@var selected_tasks: list of tasks selected
from cmd-line
@type selected_tasks: list - str
"""
tasks = dict([(t.name, t) for t in self.task_list])
default_tasks = self.config.get('default_tasks')
Expand Down
3 changes: 2 additions & 1 deletion doit/cmdparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def help_doc(self):
class CmdParse(object):
"""Process string with command options
@ivar options: (list - CmdOption)
@ivar options:
@type options: list - L{CmdOption}
"""
_type = "Command"

Expand Down
10 changes: 6 additions & 4 deletions doit/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ class TaskControl(object):
should be executed. Also apply filter to exclude tasks from
execution. And parse task cmd line options.
@ivar tasks: (dict) Key: task name ([taskgen.]name)
Value: L{Task} instance
@ivar targets: (dict) Key: fileName
Value: task_name
@ivar tasks: Key: task name ([taskgen.]name)
Value: L{Task} instance
@type tasks: dict
@ivar targets: Key: fileName
Value: task_name
@type targets: dict
"""

def __init__(self, task_list):
Expand Down
18 changes: 12 additions & 6 deletions doit/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,14 @@ class DbmDB(object):
to the 'dirty' set. Only on 'dump' all dirty items values are encoded
in json into _dbm and the DBM file is saved.
@ivar name: (str) file name/path
@ivar _dbm: (dbm) items with json encoded values
@ivar _db: (dict) items with python-dict as value
@ivar dirty: (set) id of modified tasks
@ivar name: file name/path
@type name: str
@ivar _dbm: items with json encoded values
@type _dbm: dbm
@ivar _db: items with python-dict as value
@type _db: dict
@ivar dirty: id of modified tasks
@type dirty: set
"""
DBM_CONTENT_ERROR_MSG = 'db type could not be determined'

Expand Down Expand Up @@ -373,8 +377,10 @@ class DependencyBase(object):
* 'result:', 'task:<task-name>', 'ignore:'
* user(task) defined values are defined in '_values_:' sub-dict
@ivar name: (string) filepath of the DB file
@ivar _closed: (bool) DB was flushed to file
@ivar name: filepath of the DB file
@type name: str
@ivar _closed: DB was flushed to file
@type _closed: bool
"""

def __init__(self, backend):
Expand Down
6 changes: 4 additions & 2 deletions doit/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
class ConsoleReporter(object):
"""Default reporter. print results on console/terminal (stdout/stderr)
@ivar show_out (bool): include captured stdout on failure report
@ivar show_err (bool): include captured stderr on failure report
@ivar show_out: include captured stdout on failure report
@type show_out: bool
@ivar show_err: include captured stderr on failure report
@type show_err: bool
"""
def __init__(self, outstream, options):
# save non-succesful result information (include task errors)
Expand Down
4 changes: 3 additions & 1 deletion doit/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ def finish(self):

def run_all(self, task_dispatcher):
"""entry point to run tasks
@ivar task_dispatcher (TaskDispatcher)
@param task_dispatcher:
@type task_dispatcher: L{TaskDispatcher}
"""
try:
if hasattr(self.reporter, 'initialize'):
Expand Down
86 changes: 55 additions & 31 deletions doit/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ class DelayedLoader(object):
"""contains info for delayed creation of tasks from a task-creator
@ivar creator: reference to task-creator function
@ivar task_dep: (str) name of task that should be executed before the
@ivar task_dep: name of task that should be executed before the
the loader call the creator function
@type task_dep: str
"""
def __init__(self, creator, executed=None):
self.creator = creator
Expand All @@ -41,36 +42,59 @@ def __init__(self, creator, executed=None):
class Task(object):
"""Task
@ivar name string
@ivar actions: list - L{BaseAction}
@ivar clean_actions: list - L{BaseAction}
@ivar loader (DelayedLoader)
@ivar teardown (list - L{BaseAction})
@ivar targets: (list -string)
@ivar task_dep: (list - string)
@ivar wild_dep: (list - string) task dependency using wildcard *
@ivar file_dep: (set - string)
@ivar calc_dep: (set - string) reference to a task
@ivar dep_changed (list - string): list of file-dependencies that changed
(are not up_to_date). this must be set before
@ivar uptodate: (list - bool/None) use bool/computed value instead of
checking dependencies
@ivar value_savers (list - callables) that return dicts to be added to
task values. Always executed on main process.
To be used by `uptodate` implementations.
@ivar setup_tasks (list - string): references to task-names
@ivar is_subtask: (bool) indicate this task is a subtask
@ivar has_subtask: (bool) indicate this task has subtasks
@ivar result: (str) last action "result". used to check task-result-dep
@ivar values: (dict) values saved by task that might be used by other tasks
@ivar getargs: (dict) values from other tasks
@ivar doc: (string) task documentation
@ivar options: (dict) calculated params values (from getargs and taskopt)
@ivar taskopt: (cmdparse.CmdParse)
@ivar pos_arg: (str) name of parameter in action to receive positional
parameters from command line
@ivar pos_arg_val: (list - str) list of positional parameters values
@ivar name:
@type name: str
@ivar actions:
@type actions: list - L{BaseAction}
@ivar clean_actions:
@type clean_actions: list - L{BaseAction}
@ivar loader:
@type loader: L{DelayedLoader}
@ivar teardown:
@type teardown: list - L{BaseAction}
@ivar targets:
@type targets: list -str
@ivar task_dep:
@type task_dep: list - str
@ivar wild_dep: task dependency using wildcard *
@type wild_dep: list - str
@ivar file_dep:
@type file_dep: set - str
@ivar calc_dep: reference to a task
@type calc_dep: set - str
@ivar dep_changed: (are not up_to_date). this must be set before
@type dep_changed: list - str
@ivar uptodate: use bool/computed value instead of
checking dependencies
@type uptodate: list - bool/None
@ivar value_savers: that return dicts to be added to
task values. Always executed on main process.
To be used by `uptodate` implementations.
@type value_savers: list - callable
@ivar setup_tasks: references to task-names
@type setup_tasks: list - str
@ivar is_subtask: indicate this task is a subtask
@type is_subtask: bool
@ivar has_subtask: indicate this task has subtasks
@type has_subtask: bool
@ivar result: last action "result". used to check task-result-dep
@type result: str
@ivar values: values saved by task that might be used by other tasks
@type values: dict
@ivar getargs: values from other tasks
@type getargs: dict
@ivar doc: task documentation
@type doc: str
@ivar options: calculated params values (from getargs and taskopt)
@type options: dict
@ivar taskopt:
@type taskopt: L{cmdparse.CmdParse}
@ivar pos_arg: name of parameter in action to receive positional
parameters from command line
@type pos_arg: str
@ivar pos_arg_val: list of positional parameters values
@type pos_arg_val: list - str
@ivar custom_title: function reference that takes a task object as
parameter and returns a string.
"""
Expand Down

0 comments on commit c7bfa65

Please sign in to comment.