diff options
| author | Joshua Harlow <harlowja@yahoo-inc.com> | 2014-07-11 14:13:01 -0700 |
|---|---|---|
| committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2014-07-11 14:20:02 -0700 |
| commit | 9a239a0a2e93a1ecd757d46598393ab76bbdcaa4 (patch) | |
| tree | 3f44167e1f55767b38ad6d597875c276072b1f04 /taskflow/examples/buildsystem.py | |
| parent | e4810f0d3129a07d116f21136fe8f504fb922b1c (diff) | |
| download | taskflow-9a239a0a2e93a1ecd757d46598393ab76bbdcaa4.tar.gz | |
Cleanup some of the example code & docs
This commit makes a set of small adjustments to examples.
- Rework some of the comments to be more clear.
- Add links to the original source tree file.
- Rename some of the examples to make it clear the
concept the example is intented to show.
- Move some common example functionality to the
example utility file.
Change-Id: I858e0dbf72fe8cb40a05bfdbb0857720ffb71c7f
Diffstat (limited to 'taskflow/examples/buildsystem.py')
| -rw-r--r-- | taskflow/examples/buildsystem.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/taskflow/examples/buildsystem.py b/taskflow/examples/buildsystem.py index c17628a..38f0304 100644 --- a/taskflow/examples/buildsystem.py +++ b/taskflow/examples/buildsystem.py @@ -29,8 +29,11 @@ import taskflow.engines from taskflow.patterns import graph_flow as gf from taskflow import task +import example_utils as eu # noqa -# In this example we demonstrate use of TargetedFlow to make oversimplified + +# In this example we demonstrate use of a target flow (a flow that only +# executes up to a specified target) to make an *oversimplified* pseudo # build system. It pretends to compile all sources to object files and # link them into an executable. It also can build docs, but this can be # "switched off" via targeted flow special power -- ability to ignore @@ -75,7 +78,7 @@ class BuildDocsTask(task.Task): def make_flow_and_store(source_files, executable_only=False): - flow = gf.TargetedFlow('build flow') + flow = gf.TargetedFlow('build-flow') object_targets = [] store = {} for source in source_files: @@ -97,12 +100,12 @@ def make_flow_and_store(source_files, executable_only=False): return flow, store -SOURCE_FILES = ['first.c', 'second.cpp', 'main.cpp'] - -print('Running all tasks:') -flow, store = make_flow_and_store(SOURCE_FILES) -taskflow.engines.run(flow, store=store) +if __name__ == "__main__": + SOURCE_FILES = ['first.c', 'second.cpp', 'main.cpp'] + eu.print_wrapped('Running all tasks:') + flow, store = make_flow_and_store(SOURCE_FILES) + taskflow.engines.run(flow, store=store) -print('\nBuilding executable, no docs:') -flow, store = make_flow_and_store(SOURCE_FILES, executable_only=True) -taskflow.engines.run(flow, store=store) + eu.print_wrapped('Building executable, no docs:') + flow, store = make_flow_and_store(SOURCE_FILES, executable_only=True) + taskflow.engines.run(flow, store=store) |
