Pre-compile more regexes

This commit is contained in:
Daniel Martí 2015-12-02 20:38:55 +01:00
parent 7e28e0ed90
commit 71a5eac494
2 changed files with 8 additions and 8 deletions

View file

@ -783,6 +783,9 @@ def sorted_builds(builds):
return sorted(builds, key=lambda build: int(build.vercode))
esc_newlines = re.compile('\\\\( |\\n)')
def post_metadata_parse(app):
for f in app_fields:
@ -797,8 +800,6 @@ def post_metadata_parse(app):
text = v.rstrip().lstrip()
app.set_field(f, text.split('\n'))
esc_newlines = re.compile('\\\\( |\\n)')
for build in app.builds:
for k in build_flags:
v = build.get_flag(k)
@ -970,6 +971,9 @@ def parse_yaml_metadata(metadatapath):
return app
build_line_sep = re.compile(r"(?<!\\),")
def parse_txt_metadata(metadatapath):
linedesc = None
@ -1008,8 +1012,7 @@ def parse_txt_metadata(metadatapath):
def parse_buildline(lines):
v = "".join(lines)
parts = [p.replace("\\,", ",")
for p in re.split(r"(?<!\\),", v)]
parts = [p.replace("\\,", ",") for p in re.split(build_line_sep, v)]
if len(parts) < 3:
raise MetaDataException("Invalid build format: " + v + " in " + metafile.name)
build = Build()