9 while read fop fspec fperm
; do
10 local fop
=`echo "$fop" | tr -d ' \t\n'`
11 if [ "$fop" = "+" ]; then
12 if [ ! -e "${src_dir}${fspec}" ]; then
13 echo "File not found '${src_dir}${fspec}'"
16 dpath
=`dirname "$fspec"`
17 if [ -z "$fperm" ]; then
18 dperm
=`stat -c "%a" ${src_dir}${dpath}`
20 mkdir
-p -m$dperm ${dst_dir}${dpath}
21 echo "copying: '$fspec'"
22 cp -fpR ${src_dir}${fspec} ${dst_dir}${dpath}/
23 if [ -n "$fperm" ]; then
24 chmod -R $fperm ${dst_dir}${fspec}
26 elif [ "$fop" = "-" ]; then
27 echo "removing: '$fspec'"
28 rm -fR ${dst_dir}${fspec}
29 elif [ "$fop" = "=" ]; then
30 echo "setting permissions: '$fperm' on '$fspec'"
31 chmod -R $fperm ${dst_dir}${fspec}
43 process_filespec
"$src_dir" "$dst_dir" "$filespec" ||
{
44 echo "process filespec error-ed"
48 # delete egg-info directories
49 find "$dst_dir" -name "*.egg-info" |
xargs rm -rf
51 if [ "$mode" == "sources" ] ; then
52 # Copy only python source files
53 find $dst_dir -not -name "*\.py" |
xargs rm -f
54 # Delete empty folders (if the case)
55 find $dst_dir/usr
-type d |
xargs rmdir &> /dev
/null
56 rmdir $dst_dir/usr
&> /dev
/null
60 # XXX [So that you won't goof as I did]
61 # Note: Yes, I tried to use the -O & -OO flags here.
62 # However the generated byte-codes were not portable.
63 # So, we just stuck to un-optimized byte-codes,
64 # which is still way better/faster than running
65 # Python sources all the time.
66 $python -m compileall
-b -d '/' $dst_dir ||
{
67 echo "python -m compileall err-ed"
70 # Delete source files and pyc [ un-optimized bytecode files ]
71 # We may want to make this optimization thing configurable later, but not sure atm
72 find $dst_dir -name "*\.py" |
xargs rm -f