Skip to content

Commit be74830

Browse files
committed
Better auto release notes
1 parent 4d7aa82 commit be74830

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

tooling/src/hypothesistooling/__main__.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -319,18 +319,27 @@ def update_vendored_files():
319319
fname.write_bytes(new)
320320

321321

322+
def has_diff(file_or_directory):
323+
diff = ["git", "diff", "--no-patch", "--exit-code", "--", file_or_directory]
324+
return subprocess.call(diff) != 0
325+
326+
322327
@task()
323328
def upgrade_requirements():
324329
update_vendored_files()
325330
compile_requirements(upgrade=True)
326331
subprocess.call(["./build.sh", "format"], cwd=tools.ROOT) # exits 1 if changed
327-
diff = ["git", "diff", "--no-patch", "--exit-code", "--", hp.PYTHON_SRC]
328-
if subprocess.call(diff) != 0 and not os.path.isfile(hp.RELEASE_FILE):
329-
with open(hp.RELEASE_FILE, mode="w") as f:
330-
f.write(
331-
"RELEASE_TYPE: patch\n\nThis patch updates our autoformatting "
332-
"tools, improving our code style without any API changes.\n"
332+
if has_diff(hp.PYTHON_SRC) and not os.path.isfile(hp.RELEASE_FILE):
333+
if has_diff(f"{hp.PYTHON_SRC}/hypothesis/vendor/tlds-alpha-by-domain.txt"):
334+
msg = (
335+
"our vendored `list of top-level domains "
336+
"<https://www.iana.org/domains/root/db>`__,\nwhich is used by the "
337+
"provisional :func:`~hypothesis.provisional.domains` strategy."
333338
)
339+
else:
340+
msg = "our autoformatting tools, improving our code style without any API changes."
341+
with open(hp.RELEASE_FILE, mode="w") as f:
342+
f.write(f"RELEASE_TYPE: patch\n\nThis patch updates {msg}\n")
334343
update_python_versions()
335344
subprocess.call(["git", "add", "."], cwd=tools.ROOT)
336345

0 commit comments

Comments
 (0)