Avoid random python address to be added to generated files

This commit is contained in:
Xidorn Quan 2017-07-13 09:01:40 +10:00
parent 5585ff2c44
commit 455dffc919

View file

@ -4,6 +4,7 @@
import json
import os.path
import re
import sys
BASE = os.path.dirname(__file__.replace('\\', '/'))
@ -16,6 +17,8 @@ from mako.template import Template
import data
RE_PYTHON_ADDR = re.compile(r'<.+? object at 0x[0-9a-fA-F]+>')
def main():
usage = "Usage: %s [ servo | gecko ] [ style-crate | html ] [ testing | regular ]" % sys.argv[0]
@ -68,7 +71,12 @@ def render(filename, **context):
def write(directory, filename, content):
if not os.path.exists(directory):
os.makedirs(directory)
open(os.path.join(directory, filename), "wb").write(content)
full_path = os.path.join(directory, filename)
open(full_path, "wb").write(content)
python_addr = RE_PYTHON_ADDR.search(content)
if python_addr:
abort("Found \"{}\" in {} ({})".format(python_addr.group(0), filename, full_path))
def write_html(properties):