Add print statements to describe progress

This commit is contained in:
Bruno Alla 2021-11-10 19:06:23 +00:00
parent 6f5dac8e5c
commit d08dfa32ab

View File

@ -80,6 +80,7 @@ def get_all_latest_django_versions() -> tuple[DjVersion, list[DjVersion]]:
Depends on Django versions having higher major version or minor version.
"""
print("Fetching all Django versions from PyPI")
base_txt = REQUIREMENTS_DIR / "base.txt"
with base_txt.open() as f:
for line in f.readlines():
@ -138,6 +139,7 @@ class GitHubManager:
self.load_existing_issues()
def load_requirements(self):
print("Reading requirements")
for requirements_file in self.requirements_files:
with (REQUIREMENTS_DIR / f"{requirements_file}.txt").open() as f:
for line in f.readlines():
@ -150,6 +152,7 @@ class GitHubManager:
def load_existing_issues(self):
"""Closes the issue if the base Django version is greater than needed"""
print("Load existing issues from GitHub")
qualifiers = {
"repo": GITHUB_REPO,
"state": "open",
@ -161,6 +164,7 @@ class GitHubManager:
"[Django Update]", "created", "desc", **qualifiers
)
)
print(f"Found {len(issues)} issues matching search")
for issue in issues:
issue_version_str = issue.title.split(" ")[-1]
issue_version = DjVersion.parse(issue_version_str)
@ -248,15 +252,19 @@ class GitHubManager:
def create_or_edit_issue(self, needed_dj_version: DjVersion, description: str):
if issue := self.existing_issues.get(needed_dj_version):
print(f"Editing issue #{issue.number} for Django {needed_dj_version}")
issue.edit(body=description)
else:
print(f"Creating new issue for Django {needed_dj_version}")
self.repo.create_issue(
f"[Update Django] Django {needed_dj_version}", description
)
def generate(self):
for version in self.needed_dj_versions:
print(f"Handling GitHub issue for Django {version}")
md_content = self.generate_markdown(version)
print(f"Generated markdown:\n\n{md_content}")
self.create_or_edit_issue(version, md_content)