Use Python as SHELL in Makefile.

It's a simple task, but I'm not up on my CLI tools, so I went with
Python instead of sh.  The split command doesn't have '-p' switch on
Ubuntu.  (I'm using Ubuntu on this laptop because it can correctly
configure the WiFi and the laptop has no ethernet port.)
This commit is contained in:
sforman
2023-07-27 10:32:45 -07:00
parent f60c138a2c
commit 23504f6ede
2 changed files with 12 additions and 138 deletions
+11 -6
View File
@@ -1,8 +1,13 @@
# split on Ubuntu doesn't have '-p' option! Wah!
SHELL != which python
.ONESHELL:
joy: joy.py ../defs.txt
split -p \'\'\'\.splitlines\(\) joy.py joy.py.
cat joy.py.aa ../defs.txt joy.py.ab > joy
chmod u+x joy
from pathlib import Path
SPLIT_PATTERN = "'''.splitlines()\n"
joy_source = Path('joy.py').read_text()
defs_source = Path('../defs.txt').read_text()
head, sep, tail = joy_source.partition(SPLIT_PATTERN)
joy = Path('joy')
joy.write_text(''.join((head, defs_source, sep, tail)))
joy.chmod(0o775)
clean:
$(RM) -fv joy joy.py.*