Convert perl usage to python

We're trying to remove the usage of perl during the build. Since this is
called via python, it should hopefully be safe to use python (though
using whatever python in the path isn't a great option).

Test: treehugger
Change-Id: I0b37e7af7fe668a968f9d06a3db54e82dd58c76a
diff --git a/scripts/brillo_update_payload b/scripts/brillo_update_payload
index 7c1a6ce..47ac830 100755
--- a/scripts/brillo_update_payload
+++ b/scripts/brillo_update_payload
@@ -279,14 +279,12 @@
 
 # truncate_file <file_path> <file_size>
 #
-# Truncate the given |file_path| to |file_size| using perl.
+# Truncate the given |file_path| to |file_size| using python.
 # The truncate binary might not be available.
 truncate_file() {
   local file_path="$1"
   local file_size="$2"
-  perl -e "open(FILE, \"+<\", \$ARGV[0]); \
-           truncate(FILE, ${file_size}); \
-           close(FILE);" "${file_path}"
+  python -c "open(\"${file_path}\", 'a').truncate(${file_size})"
 }
 
 # Create a temporary file in the work_dir with an optional pattern name.