Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to fix bug on latest godoc extraction and fail on error #1021

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions py/kubeflow/testing/go-license-tools/get_github_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,10 @@ def fetch_github_uri_from_godoc(url):
response.reason)

soup = Soup(response.text, features="html.parser")
navs = soup.find_all("div", class_="UnitMeta")
navs = soup.find_all("div", class_="UnitMeta-repo")
for nav in navs:
if nav.text.strip().startswith("Repository"):
link = nav.select_one('a').attrs.get('href')
return get_github_repo(link)
link = nav.select_one('a').attrs.get('href')
return get_github_repo(link)
return None


Expand Down Expand Up @@ -181,12 +180,15 @@ def main():
else:
# Try to resolve if not found
repo = get_github_repo_for_dep(dep)
if repo in repo_seen:
print('repo {} is seen more than once'.format(repo), file=sys.stderr)
if repo is not None:
if repo in repo_seen:
print('repo {} is seen more than once'.format(repo), file=sys.stderr)
else:
repo_seen.add(repo)
print(repo, file=output_file)
dep_succeeded.append(dep)
else:
repo_seen.add(repo)
print(repo, file=output_file)
dep_succeeded.append(dep)
raise Exception('Cant find dep {}'.format(dep))
except Exception as e: # pylint: disable=broad-except
print('[failed]', e, file=sys.stderr)
traceback.print_exc(file=sys.stderr)
Expand All @@ -201,6 +203,7 @@ def main():
print('We failed to resolve the following dependencies:', file=sys.stderr)
for dep in dep_failed:
print(dep, file=sys.stderr)
sys.exit(1)


if __name__ == '__main__':
Expand Down