From 8e1ba1d42b4b94c3c75b4013a19234ab530c629a Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Mon, 2 Sep 2024 02:02:42 -0700 Subject: [PATCH] formatting changes to appease the linter on the PR --- publish.py | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/publish.py b/publish.py index 039cadc..09e37d4 100755 --- a/publish.py +++ b/publish.py @@ -71,11 +71,11 @@ def __init__(self, options): current_tag = self.repo.rev_parse(current_name) print(f"Current tag id: {current_tag}", file=sys.stderr) try: - self.current_tag = current_tag.tag - print(f"Current tag: {self.current_tag}", file=sys.stderr) + self.current_tag = current_tag.tag + print(f"Current tag: {self.current_tag}", file=sys.stderr) except (AttributeError, BadName, GitCommandError): - print("Not an annotated tag!", file=sys.stderr) - exit(4) + print("Not an annotated tag!", file=sys.stderr) + exit(4) def ready_for_release(self): """Return true if the current git checkout is suitable for release @@ -96,7 +96,10 @@ def ready_for_release(self): return False tag_is_valid = self.RELEASE_TAG_PATTERN.match(self.current_tag) is not None if not tag_is_valid: - print(f"""Tag "{self.current_tag}" is not a valid release tag. Expected "vX.Y.Z" where X, Y, and Z are non-negative integers, formatted without leading zeros.""", file=sys.stderr) + print(f"""Tag "{self.current_tag}" is not a valid release tag."""+ + """Expected "vX.Y.Z" where X, Y, and Z are non-negative integers, formatted without leading zeros.""", + file=sys.stderr + ) return tag_is_valid def generate_changelog(self): @@ -155,7 +158,9 @@ def format_rst_changelog(changelog, options): links[sha] = f".. _{sha}: https://github.com/{options.organization}/{options.repository}/commit/{sha}" for match in ISSUE_NUMBER.finditer(summary): issue_number = match.group(1) - links[issue_number] = f".. _#{issue_number}: https://github.com/{options.organization}/{options.repository}/issues/{issue_number}" + links[issue_number] = ( + f".. _#{issue_number}: https://github.com/{options.organization}/{options.repository}/issues/{issue_number}" + ) summary = ISSUE_NUMBER.sub(r"`#\1`_", summary) output.append(f"* `{sha}`_: {summary}") output.append("") @@ -182,13 +187,14 @@ def create_artifacts(changelog, options): formatted_changelog = format_rst_changelog(changelog, options) with open(fd, "w", encoding="utf-8") as fobj: fobj.write(formatted_changelog) - subprocess.check_call([ - sys.executable, "setup.py", - "egg_info", "--tag-build=", - "sdist", - "bdist_wheel", "--universal" + subprocess.check_call( + [ + sys.executable, "setup.py", + "egg_info", "--tag-build=", + "sdist", + "bdist_wheel", "--universal" ], - env=( os.environ.copy() | {"CHANGELOG_FILE": name} ) # see https://stackoverflow.com/a/78652759 + env=(os.environ.copy() | {"CHANGELOG_FILE": name}) # see https://stackoverflow.com/a/78652759 ) os.unlink(name) return [os.path.abspath(os.path.join("dist", fname)) for fname in os.listdir("dist")] @@ -220,7 +226,12 @@ def main(): parser.add_argument("repository", help="The name of the repository on GitHub") options = parser.parse_args() if "GITHUB_TOKEN" not in os.environ: - print("Publish requires the GITHUB_TOKEN environment variable to be set. Before you run this command, try `export GITHUB_TOKEN=your-gh-token-blah-blah-blah-whatever` (on Unix-likes) or `set GITHUB_TOKEN=your-gh-token-blah-blah-blah-whatever` (on Windows)\n\nPublish also requires the TWINE_USERNAME and TWINE_PASSWORD environment variables to be set in the same way; but, unlike GITHUB_TOKEN, you will be prompted to provide them later if they aren't in the environment, so setting them beforehand is not mandatory.") + print("Publish requires the GITHUB_TOKEN environment variable to be set."+ + "Before you run this command, try `export GITHUB_TOKEN=your-gh-token-blah-blah-blah-whatever` (on Unix-likes) or "+ + "`set GITHUB_TOKEN=your-gh-token-blah-blah-blah-whatever` (on Windows)\n\nPublish also requires the TWINE_USERNAME and"+ + "TWINE_PASSWORD environment variables to be set in the same way; but, unlike GITHUB_TOKEN, you will be prompted to provide"+ + "them later if they aren't in the environment, so setting them beforehand is not mandatory." + ) sys.exit(3) sys.exit(publish(options))