Skip to content

Conversation

@AA-Turner
Copy link
Member

str.splitlines() doesn't preserve trailing lines (unless using keepends=True), whereas str.split('\n') does. Use the latter form, and assert that modified files end with a blank line in tests.

A

# Update first line: "This is Python version X.Y.Z {release_level} N"
# and update length of underline in second line to match.
lines = readme.read_text().splitlines()
lines = readme.read_text(encoding="utf-8").split("\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
lines = readme.read_text(encoding="utf-8").split("\n")
lines = readme.read_text().split("\n")

I think we can skip this, we have a platform check:

release-tools/run_release.py

Lines 1375 to 1384 in a8981b1

if sys.platform not in ("darwin", "linux"):
print(
"""\
WARNING! This script has not been tested on a platform other than Linux and macOS.
Although it should work correctly as long as you have all the dependencies,
some things may not work as expected. As a release manager, you should try to
fix these things in this script so it also supports your platform.
"""
)

And there's no RM using Windows now, or next. Perhaps the next one after Savannah will in 2028, but we can deal with it then (along with likely other Windows incompatibilities), and we might be using 3.15 as the minimum by then, with UTF-8 as default.


original_readme_file = Path(__file__).parent / "README.rst"
original_contents = original_readme_file.read_text()
original_contents = original_readme_file.read_text(encoding="utf-8")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
original_contents = original_readme_file.read_text(encoding="utf-8")
original_contents = original_readme_file.read_text()

original_lines = original_contents.splitlines()
new_lines = readme_file.read_text().splitlines()
original_lines = original_contents.split("\n")
new_contents = readme_file.read_text(encoding="utf-8")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new_contents = readme_file.read_text(encoding="utf-8")
new_contents = readme_file.read_text()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants