From e7dd579ebf14317e284f4f9641e4bf0b8f99022f Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Fri, 12 Aug 2016 16:53:35 -0400 Subject: [PATCH] Ignore TOML failing to parse Cargo.lock, due to a bug --- python/tidy/servo_tidy/tidy.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 8d989303b05e..f4b893bda8c4 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -298,8 +298,18 @@ def find_reverse_dependencies(dependency, version, content): # package names to be neglected (as named by cargo) exceptions = ["lazy_static"] - import toml - content = toml.loads(contents) + # toml.py has a bug(?) that we trip up in [metadata] sections; + # see https://github.com/uiri/toml/issues/61 + # This should only affect a very few lines (that have embedded ?branch=...), + # and most of them won't be in the repo + try: + import toml + content = toml.loads(contents) + except: + print "WARNING!" + print "WARNING! toml parsing failed for Cargo.lock, but ignoring..." + print "WARNING!" + raise StopIteration packages = {} for package in content.get("package", []):