File tree Expand file tree Collapse file tree 4 files changed +112
-2
lines changed Expand file tree Collapse file tree 4 files changed +112
-2
lines changed Original file line number Diff line number Diff line change @@ -22,11 +22,33 @@ clean:
22
22
rm -rf src/plugins/install/built-in
23
23
rm -rf src/user-guide/task-implementation/job-runner-handlers
24
24
25
+ watch : clean
26
+ # rebuild incrementally whenever documentation files are changed
27
+ sphinx-autobuild " $( SOURCEDIR) " " $( BUILDDIR) " \
28
+ --ignore=' **plugins/main-loop/built-in/*.rst' \
29
+ --ignore=' **plugins/install/built-in/*.rst' \
30
+ --ignore=' **/job-runner-handlers/*.rst' \
31
+ --open-browser
32
+
33
+ watch-cylc :
34
+ # rebuild non-incrementally (SLOW) whenever docs files OR Cylc source
35
+ # code files are changed
36
+ sphinx-autobuild " $( SOURCEDIR) " " $( BUILDDIR) " \
37
+ -a \
38
+ --pre-build=' make clean' \
39
+ --ignore=' **plugins/main-loop/built-in/*.rst' \
40
+ --ignore=' **plugins/install/built-in/*.rst' \
41
+ --ignore=' **/job-runner-handlers/*.rst' \
42
+ --watch=" $( shell bin/c-locate cylc.flow) " \
43
+ --watch=" $( shell bin/c-locate cylc.uiserver) " \
44
+ --watch=" $( shell bin/c-locate cylc.rose) " \
45
+ --open-browser
46
+
25
47
cleanall :
26
48
(cd doc; echo [0-9]* .* )
27
49
rm -rI doc/[0-9]* .*
28
50
29
- .PHONY : help clean Makefile .EXPORT_ALL_VARIABLES
51
+ .PHONY : help clean watch Makefile .EXPORT_ALL_VARIABLES
30
52
31
53
# Catch-all target: route all unknown targets to Sphinx using the new
32
54
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Original file line number Diff line number Diff line change @@ -86,9 +86,56 @@ We use a few custom Sphinx extensions, for details see
86
86
$
git clone [email protected] :cylc/cylc-doc.git cylc-doc
87
87
$ cd cylc-doc
88
88
$ pip install -e .
89
+ ```
90
+
91
+ ### Simple Build
92
+
93
+ Build the docs using ` make ` :
94
+
95
+ ``` console
89
96
$ make html
90
97
```
91
98
99
+ The documentation builds incrementally, if you make changes to the Cylc source
100
+ files run ` make clean ` :
101
+
102
+ ``` console
103
+ $ make clean html
104
+ ```
105
+
106
+ ### Automatic Build
107
+
108
+ You can also get Sphinx to rebuild automatically when documentation files are
109
+ modified. Fist install the optional dependency ` watch ` :
110
+
111
+ ``` console
112
+ $ pip install -e .[watch]
113
+
114
+ ```
115
+
116
+ Then build the ` watch ` target:
117
+
118
+ ``` console
119
+ $ make watch # you do not need to `make clean` with the `watch` target
120
+ ```
121
+
122
+ This will monitor for changes in the ` cylc-doc ` repository and rebuild the
123
+ documentation incrementally.
124
+
125
+ To also monitor for changes in the ` cylc-flow ` , ` cylc-uiserver ` and ` cylc-rose `
126
+ repositories use the ` watch-cylc ` target:
127
+
128
+ ``` console
129
+ $ make watch-cylc # you do not need to `make clean` with the `watch` target
130
+ ```
131
+
132
+ This forces a complete rebuild every time a file is changed which is slow, but
133
+ allows it to pick up changes to autodocumented items in the source code.
134
+
135
+ > ** Note:** Your Cylc repositories must be installed in editible mode
136
+ > i.e. ` pip install -e <repo> ` for this to work.
137
+ > ** Note:** This might not work for all filesystems.
138
+
92
139
## Testing
93
140
94
141
``` console
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ # THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
3
+ # Copyright (C) NIWA & British Crown (Met Office) & Contributors.
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ """Locate Python repository installations."""
19
+
20
+ from pathlib import Path
21
+ import sys
22
+
23
+
24
+ def main (arg ):
25
+ if arg == 'cylc.flow' :
26
+ import cylc .flow
27
+ print (Path (cylc .flow .__file__ ).parent )
28
+ elif arg == 'cylc.uiserver' :
29
+ import cylc .uiserver
30
+ print (Path (cylc .uiserver .__file__ ).parent )
31
+ elif arg == 'cylc.rose' :
32
+ import cylc .rose
33
+ print (Path (cylc .rose .__file__ ).parent )
34
+ else :
35
+ raise ValueError (f'Unsupported arg: { arg } ' )
36
+
37
+
38
+ if __name__ == '__main__' :
39
+ main (sys .argv [1 ])
Original file line number Diff line number Diff line change @@ -59,7 +59,9 @@ def get_version(module, path):
59
59
'flake8-mutable>=1.2.0' ,
60
60
'flake8-simplify>=0.14.0' ,
61
61
],
62
-
62
+ 'watch' : [
63
+ 'sphinx-autobuild' ,
64
+ ],
63
65
}
64
66
EXTRAS_REQUIRE ['all' ] = [y for x in EXTRAS_REQUIRE .values () for y in x ]
65
67
You can’t perform that action at this time.
0 commit comments