mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #17702 - upsuper:python-addr-in-generated, r=emilio
Avoid random python address to be added to generated files This would catch cases like #17691 and avoid regressing [bug 1380327](https://bugzilla.mozilla.org/show_bug.cgi?id=1380327) in this manner. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17702) <!-- Reviewable:end -->
This commit is contained in:
commit
9451b41d33
1 changed files with 9 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os.path
|
import os.path
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
BASE = os.path.dirname(__file__.replace('\\', '/'))
|
BASE = os.path.dirname(__file__.replace('\\', '/'))
|
||||||
|
@ -16,6 +17,8 @@ from mako.template import Template
|
||||||
|
|
||||||
import data
|
import data
|
||||||
|
|
||||||
|
RE_PYTHON_ADDR = re.compile(r'<.+? object at 0x[0-9a-fA-F]+>')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
usage = "Usage: %s [ servo | gecko ] [ style-crate | html ] [ testing | regular ]" % sys.argv[0]
|
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):
|
def write(directory, filename, content):
|
||||||
if not os.path.exists(directory):
|
if not os.path.exists(directory):
|
||||||
os.makedirs(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):
|
def write_html(properties):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue