Skip to content

Instantly share code, notes, and snippets.

@ratazzi
Created July 20, 2012 06:15
Show Gist options
  • Save ratazzi/3149008 to your computer and use it in GitHub Desktop.
Save ratazzi/3149008 to your computer and use it in GitHub Desktop.
# Makefile for dict
#
# [email protected]
#
define zipheader
#!/bin/bash
PYTHON=$$(which python 2>/dev/null)
if [ ! -x "$${PYTHON}" ]; then
echo "Python executable not found"
exit 1
fi
if [ -n "$${1}" ]; then
word="$${@}"
else
read word
fi
exec "$${PYTHON}" - "$${0}" "$$word" << END_OF_PYTHON_CODE
import sys
sys.path.insert(0, sys.argv[1])
del sys.argv[0]
import dict
dict.main()
END_OF_PYTHON_CODE
# vim: ft=sh
endef
export zipheader
help:
@echo ' app generate one file app.'
@echo ' clean cleanup.'
app:
@echo "$$zipheader" > dict
zip - dict.py BeautifulSoup.py | cat - >> dict
chmod +x dict
clean:
rm -f dict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment