fix folly build under python 3
authorMarcin Pawlowski <mpawlowski@fb.com>
Mon, 26 Jan 2015 21:57:21 +0000 (13:57 -0800)
committerwoo <woo@fb.com>
Mon, 2 Feb 2015 21:12:46 +0000 (13:12 -0800)
Summary:
Make python scripts compatible woth both python 3 and python 2.
Added ignore rule for test/glog directory.

Facebook:
While verifying some issues reported on github i noticed that
folly does not build when python 3 is the default (at least on arch
linux). As it turns out it is fairly easy to make our python files
compatible with both python 2 and python 3.
I also added test/glog*/* to gitignore so that it is easier to work
on folly outside of facebook.

Test Plan:
unit tests in fb envirnoment and unit test on arch linux
(python 3.4.2, gcc 4.9.2)

Reviewed By: njormrod@fb.com

Subscribers: trunkagent, folly-diffs@

FB internal diff: D1801368

Signature: t1:1801368:1422294777:4e7b6b5634e8dccd849194e171c9a342bd1cb8b8

folly/build/generate_escape_tables.py
folly/build/generate_format_tables.py
folly/test/.gitignore

index 0d18978e470b6a808e80aa1f609716d57cdfed81..03df62a35181c8796ff755ed653ac8bb9fc5f1d6 100755 (executable)
@@ -79,10 +79,10 @@ def generate(f):
     # 4 = always percent-encode
     f.write("extern const unsigned char uriEscapeTable[] = {")
     passthrough = (
-        range(ord('0'), ord('9')) +
-        range(ord('A'), ord('Z')) +
-        range(ord('a'), ord('z')) +
-        map(ord, '-_.~'))
+        list(range(ord('0'), ord('9'))) +
+        list(range(ord('A'), ord('Z'))) +
+        list(range(ord('a'), ord('z'))) +
+        list(map(ord, '-_.~')))
     for i in range(0, 256):
         if i % 16 == 0:
             f.write("\n  ")
index c4255eca244a4903f99eb617ebf7cb6ac346de1a..45abc4ca679d472aac577f9b407af4439e74a8f4 100755 (executable)
@@ -33,14 +33,14 @@ def generate_conv_table(f, name, values):
     f.write("};\n\n")
 
 def octal_values():
-    return (tuple("{0:03o}".format(x)) for x in xrange(512))
+    return (tuple("{0:03o}".format(x)) for x in range(512))
 
 def hex_values(upper):
     fmt = "{0:02X}" if upper else "{0:02x}"
-    return (tuple(fmt.format(x)) for x in xrange(256))
+    return (tuple(fmt.format(x)) for x in range(256))
 
 def binary_values():
-    return (tuple("{0:08b}".format(x)) for x in xrange(256))
+    return (tuple("{0:08b}".format(x)) for x in range(256))
 
 def generate(f):
     f.write("#include <folly/FormatArg.h>\n"
index 7e563b8b3023b7b9cc879c0052dfcc26b9f82505..baa95bcaf0101b25bc6625552664dd81dccb0d0a 100644 (file)
@@ -1,2 +1,3 @@
 *.log
 *.trs
+gtest*/*