Skip to content

Commit

Permalink
Ignore TOML failing to parse Cargo.lock, due to a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vvuk committed Aug 17, 2016
1 parent 59da96d commit e7dd579
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions python/tidy/servo_tidy/tidy.py
Expand Up @@ -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", []):
Expand Down

0 comments on commit e7dd579

Please sign in to comment.