mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Add an assertion to check the version got modified
This commit is contained in:
parent
9dff8c1440
commit
53eba71ef4
1 changed files with 6 additions and 0 deletions
|
@ -88,13 +88,19 @@ def generate_news(session: Session, version: str) -> None:
|
||||||
def update_version_file(version: str, filepath: str) -> None:
|
def update_version_file(version: str, filepath: str) -> None:
|
||||||
with open(filepath, "r", encoding="utf-8") as f:
|
with open(filepath, "r", encoding="utf-8") as f:
|
||||||
content = list(f)
|
content = list(f)
|
||||||
|
|
||||||
|
file_modified = False
|
||||||
with open(filepath, "w", encoding="utf-8") as f:
|
with open(filepath, "w", encoding="utf-8") as f:
|
||||||
for line in content:
|
for line in content:
|
||||||
if line.startswith("__version__ ="):
|
if line.startswith("__version__ ="):
|
||||||
f.write('__version__ = "{}"\n'.format(version))
|
f.write('__version__ = "{}"\n'.format(version))
|
||||||
|
file_modified = True
|
||||||
else:
|
else:
|
||||||
f.write(line)
|
f.write(line)
|
||||||
|
|
||||||
|
assert file_modified, \
|
||||||
|
"Version file {} did not get modified".format(filepath)
|
||||||
|
|
||||||
|
|
||||||
def create_git_tag(session: Session, tag_name: str, *, message: str) -> None:
|
def create_git_tag(session: Session, tag_name: str, *, message: str) -> None:
|
||||||
session.run(
|
session.run(
|
||||||
|
|
Loading…
Reference in a new issue