Fix a few coding style nits in Buck build Python scripts

- Prefix regex strings with `r`
- Remove unused imports
- Rename variables and parameters to avoid redefinition of
  built-in types `dir` and `type`

Change-Id: Ia21667b89631c751f241dd6499a2e460e3435697
diff --git a/tools/pack_war.py b/tools/pack_war.py
index 0ba802b..4c5cd89 100755
--- a/tools/pack_war.py
+++ b/tools/pack_war.py
@@ -28,8 +28,8 @@
 root = war[:war.index('buck-out')]
 jars = set()
 
-def link_jars(libs, dir):
-  makedirs(dir)
+def link_jars(libs, directory):
+  makedirs(directory)
   cp = check_output(['buck', 'audit', 'classpath'] + libs)
   for j in cp.strip().splitlines():
     if j not in jars:
@@ -37,7 +37,7 @@
       n = path.basename(j)
       if j.startswith('buck-out/gen/gerrit-'):
         n = j.split('/')[2] + '-' + n
-      symlink(path.join(root, j), path.join(dir, n))
+      symlink(path.join(root, j), path.join(directory, n))
 
 if args.lib:
   link_jars(args.lib, path.join(war, 'WEB-INF', 'lib'))