4 [ -z "$SOURCE_DATE_EPOCH" ] ||
{
5 PYTHONHASHSEED
="$SOURCE_DATE_EPOCH"
15 while read fop fspec fperm
; do
16 local fop
=`echo "$fop" | tr -d ' \t\n'`
17 if [ "$fop" = "+" ]; then
18 if [ ! -e "${src_dir}${fspec}" ]; then
19 echo "File not found '${src_dir}${fspec}'"
22 dpath
=`dirname "$fspec"`
23 if [ -z "$fperm" ]; then
24 dperm
=`stat -c "%a" ${src_dir}${dpath}`
26 mkdir
-p -m$dperm ${dst_dir}${dpath}
27 echo "copying: '$fspec'"
28 cp -fpR ${src_dir}${fspec} ${dst_dir}${dpath}/
29 if [ -n "$fperm" ]; then
30 chmod -R $fperm ${dst_dir}${fspec}
32 elif [ "$fop" = "-" ]; then
33 echo "removing: '$fspec'"
34 rm -fR ${dst_dir}${fspec}
35 elif [ "$fop" = "=" ]; then
36 echo "setting permissions: '$fperm' on '$fspec'"
37 chmod -R $fperm ${dst_dir}${fspec}
45 if [ -d "$dst_dir/usr" ] ; then
46 find "$dst_dir/usr" -empty -type d
-delete
59 find "$src_dir" -name "*.exe" -delete
61 process_filespec
"$src_dir" "$dst_dir" "$filespec" ||
{
62 echo "process filespec error-ed"
66 usr_bin_dir
="$dst_dir/usr/bin"
68 if [ -d "$usr_bin_dir" ] ; then
69 $SED "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python${ver}," -i --follow-symlinks $usr_bin_dir/*
72 if [ "$mode" == "sources" ] ; then
73 # Copy only python source files
74 find "$dst_dir" -not -type d
-not -name "*.py" -delete
76 delete_empty_dirs
"$dst_dir"
81 [ "$ver" == "3" ] && legacy
="-b"
82 # default max recursion is 10
83 max_recursion_level
=20
85 # XXX [So that you won't goof as I did]
86 # Note: Yes, I tried to use the -O & -OO flags here.
87 # However the generated byte-codes were not portable.
88 # So, we just stuck to un-optimized byte-codes,
89 # which is still way better/faster than running
90 # Python sources all the time.
91 $python -m compileall
-r "$max_recursion_level" $legacy -d '/' "$dst_dir" ||
{
92 echo "python -m compileall err-ed"
96 # Delete source files and pyc [ un-optimized bytecode files ]
97 # We may want to make this optimization thing configurable later, but not sure atm
98 find "$dst_dir" -type f
-name "*.py" -delete
100 delete_empty_dirs
"$dst_dir"