blob: e9e0a15bcd4cd5a2ddc8f7ecb809d88c7856fa23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/sh
# pycgen: a build-time utiltiy script
# objective: generate the correcponding python byte-code (.pyc)
# object files for one or more source python (.py)
# scripts.
if [ -z "$PYCGEN_PYTHON" ]; then
pycompile='python'
else
pycompile="$PYCGEN_PYTHON"
fi
refdir=$(pwd)
for pysrc in $@; do
basename=$(basename "$pysrc");
dstdir=$(dirname "$pysrc")
if [ -z "$dstdir" ]; then
dstdir='.'
fi
cd "$dstdir" || exit 2
"$pycompile" -m py_compile "$basename" || exit 2
cd "$refdir"
done
exit 0
|