diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-12 17:51:55 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-12 17:51:55 +0200 |
commit | 762fa897d2abe72412f9d16948ac2f172ce8b721 (patch) | |
tree | 18e55b82e45af6695b4527ddd9a41d4d9f9abd3c | |
parent | e80a005de6de339e1abad140c0ed2cfa0ef7dbaf (diff) | |
download | psutil-762fa897d2abe72412f9d16948ac2f172ce8b721.tar.gz |
parse comment blocks
-rwxr-xr-x | scripts/internal/check_broken_links.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/scripts/internal/check_broken_links.py b/scripts/internal/check_broken_links.py index 2d2d9d30..70f368e0 100755 --- a/scripts/internal/check_broken_links.py +++ b/scripts/internal/check_broken_links.py @@ -109,10 +109,16 @@ def get_urls_py(filename): if urls: assert len(urls) == 1, urls url = urls[0] - if line.startswith('# '): - nextline = lines[i + 1].strip() - if re.match('^# .+', nextline): - url += nextline[1:].strip() + # comment block + if line.lstrip().startswith('# '): + subidx = i + 1 + while 1: + nextline = lines[subidx].strip() + if re.match('^# .+', nextline): + url += nextline[1:].strip() + else: + break + subidx += 1 ret.add(url) return list(ret) |