Use the zipapp module of python instead of using zip and manually adding the hashbang

This commit is contained in:
Juhani Krekelä 2018-09-08 19:12:43 +03:00
parent 8c0505a077
commit 0961a952cb
1 changed files with 3 additions and 12 deletions

View File

@ -15,28 +15,19 @@ sshwot-export-known-hosts: $(SSHWOT_EXPORT_KNOWN_HOSTS_MAIN) $(SSHWOT_EXPORT_KNO
mkdir -p build/$@
cp $(SSHWOT_EXPORT_KNOWN_HOSTS_DEPS) build/$@/
cp $(SSHWOT_EXPORT_KNOWN_HOSTS_MAIN) build/$@/__main__.py
zip --quiet --junk-paths build/$@.zip build/$@/*.py
echo '#!/usr/bin/env python3' > $@
cat build/$@.zip >> $@
chmod +x $@
python3 -m zipapp -o $@ -p "/usr/bin/env python3" build/$@
sshwot-filter: $(SSHWOT_FILTER_MAIN) $(SSHWOT_FILTER_DEPS)
mkdir -p build/$@
cp $(SSHWOT_FILTER_DEPS) build/$@/
cp $(SSHWOT_FILTER_MAIN) build/$@/__main__.py
zip --quiet --junk-paths build/$@.zip build/$@/*.py
echo '#!/usr/bin/env python3' > $@
cat build/$@.zip >> $@
chmod +x $@
python3 -m zipapp -o $@ -p "/usr/bin/env python3" build/$@
sshwot-verify: $(SSHWOT_VERIFY_MAIN) $(SSHWOT_VERIFY_DEPS)
mkdir -p build/$@
cp $(SSHWOT_VERIFY_DEPS) build/$@/
cp $(SSHWOT_VERIFY_MAIN) build/$@/__main__.py
zip --quiet --junk-paths build/$@.zip build/$@/*.py
echo '#!/usr/bin/env python3' > $@
cat build/$@.zip >> $@
chmod +x $@
python3 -m zipapp -o $@ -p "/usr/bin/env python3" build/$@
.PHONY: all clean distclean buildclean