Skip to content
Browse files

Support Python 3.

  • Loading branch information...
1 parent fa09d68 commit 531e90ef226f2bb75a239fdc7676639b5bef0c9f @aduros committed
Showing with 15 additions and 6 deletions.
  1. +1 −1 .gitignore
  2. +14 −5 bin/wafl
View
2 .gitignore
@@ -1,5 +1,5 @@
build
chxdoc
.lock-waf*
-bin/.waf-*
+bin/.waf*
*.fdz
View
19 bin/wafl
@@ -28,9 +28,18 @@ except IOError:
print("Could not locate Flambe, run `haxelib install flambe`.")
sys.exit(1)
-# Let waf find our custom tools
-sys.path.insert(0, join(flambe_root, "tools", "waf"))
-
+# We can't just use runpy because waf contains null bytes, so open and exec it manually, leaving out
+# the binary section
waf = join(flambe_root, "bin", "waf")
-sys.argv[0] = waf # Kinda silly
-execfile(waf)
+with open(waf, "rb") as f:
+ src = bytearray()
+ terminator = "#==>\n".encode()
+ for line in f:
+ if line == terminator: break
+ src += line
+
+ # Let waf find our custom tools
+ sys.path.insert(0, join(flambe_root, "tools", "waf"))
+ sys.argv[0] = waf # Kinda silly
+
+ exec(compile(src, waf, "exec"))

0 comments on commit 531e90e

Please sign in to comment.
Something went wrong with that request. Please try again.