Skip to content

Commit 8761725

Browse files
JoppeJoppe
authored andcommitted
[doc] Explain the .shebang recipy
1 parent d2753bf commit 8761725

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

example/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ $ greeter.py --help | awk '{ print "\t" $0 }'
104104

105105
---
106106

107-
Standalone variant:
107+
A finished build contain the bringup recipies used and their command output. Here is how that works for .py files:
108108

109109
```sh
110110
$ greeter.py --make --dep test/greeter.py.mk | tee test/greeter.mk
@@ -155,14 +155,27 @@ $!$*.py.tested: $/$*.py $!$*.py.bringup
155155
$/clear:
156156
git clean -xfd $(dir $@)
157157

158+
$ cat test/greeter.py.mk
159+
$!greeter.py.bringup: $/greeter.py $!greeter.py.shebang | $($/_PYTHON) # Make sure $/greeter.py is setup OK
160+
$| -m pip install fire --no-warn-script-location > $@
161+
158162
$ make --no-print-directory -f test/greeter.mk tested
159163
.../python... make.py greeter.py --shebang > test/greeter.py.shebang && cat test/greeter.py.shebang && sh test/greeter.py.shebang
160164
greeter.py --dep test/greeter.py.mk > /dev/null
161165
.../python... -m pip install fire --no-warn-script-location > test/greeter.py.bringup
162166
greeter.py --test > test/greeter.py.tested
163167

168+
$ cat test/greeter.py.shebang
169+
170+
$ cat test/greeter.py.bringup
171+
... fire in ... (...)
172+
... termcolor in ... (from fire) (...)
173+
164174
$ cat test/greeter.py.tested
165175
All 2 python usage examples PASS
166176

167177
$ rm -r test/
168178
```
179+
The .shebang recipy normalizes the python script by injecting a shebang (OS informer on which interpreter to use)
180+
but it also injects an `import make` statement if missing and installs the local directory `.` on PATH. This is used
181+
in later recipies. The goal is to make developing script-based local tools as natural as compiled ones.

0 commit comments

Comments
 (0)