Add command line args and run pep8

Change-Id: Id07ece2431bdaac5465fe751bd146ba1f1208fdd
Signed-off-by: Michael Shepos <shepos@us.ibm.com>
diff --git a/edtanous/rootfs_size.py b/edtanous/rootfs_size.py
old mode 100644
new mode 100755
index 3751fcf..7d6ef85
--- a/edtanous/rootfs_size.py
+++ b/edtanous/rootfs_size.py
@@ -2,21 +2,32 @@
 import tempfile
 import os
 from os.path import join, getsize
+import argparse
 
-# TODO
-# - Make build directory an input parameter
-# - Make squashfs file an input parameter
-# - Fix 80 char violations and run through pep8
+# Set command line arguments
+parser = argparse.ArgumentParser(
+            formatter_class=argparse.ArgumentDefaultsHelpFormatter)
 
-BUILD_DIR = "/home/ed/openbmc-openbmc"
+parser.add_argument("-b", "--build_dir",
+                    dest="BUILD_DIR",
+                    default="/home/ed/openbmc-openbmc",
+                    help="Build directory path.")
+
+parser.add_argument("-s", "--squashfs_file",
+                    dest="SQUASHFS_FILE",
+                    default="/build/tmp/deploy/images/wolfpass" +
+                    "/intel-platforms-wolfpass.squashfs-xz",
+                    help="Squashfs file.")
+
+args = parser.parse_args()
+
 # files below this size wont be attempted
 FILE_SIZE_LIMIT = 0
 
-SQUASHFS = BUILD_DIR + \
-    "/build/tmp/deploy/images/wolfpass/intel-platforms-wolfpass.squashfs-xz"
+SQUASHFS = args.BUILD_DIR + args.SQUASHFS_FILE
 
 original_size = getsize(SQUASHFS)
-print("squashfs size: ".format(original_size))
+print ("squashfs size: {}".format(original_size))
 
 results = []
 
@@ -35,7 +46,7 @@
                 filepath = os.path.join(root, name)
                 if not os.path.islink(filepath):
                     # ensure files/dirs can be renamed
-                    os.chmod(filepath,0o711)
+                    os.chmod(filepath, 0o711)
                     if getsize(filepath) > FILE_SIZE_LIMIT:
                         files_to_test.append(filepath)
 
@@ -47,10 +58,13 @@
             os.rename(filepath, newname)
             with tempfile.TemporaryDirectory() as newsquashfsroot:
                 subprocess.check_output(
-                    ["mksquashfs", tempsquashfsdir, newsquashfsroot + "/test", "-comp", "xz"])
+                    ["mksquashfs", tempsquashfsdir,
+                     newsquashfsroot + "/test", "-comp", "xz"])
 
                 results.append((filepath.replace(squashfsdir, ""),
-                                original_size - getsize(newsquashfsroot + "/test")))
+                                original_size -
+                                getsize(newsquashfsroot + "/test")))
+
             os.rename(newname, filepath)
 
             print("{:>6} of {}".format(len(results), len(files_to_test)))