From ef2d571761c497064f8cfee1c95cc362937ef6f5 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Tue, 18 Oct 2022 19:24:08 +0100 Subject: [PATCH] Support building wheel from sdist Build hook is also called for the wheel since: 38dea6b7 ("Fix install with pip git+https", 2022-09-13) --- tools/hatch_build.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/hatch_build.py b/tools/hatch_build.py index 50c80bc1..0e3a1e5f 100644 --- a/tools/hatch_build.py +++ b/tools/hatch_build.py @@ -41,9 +41,12 @@ class CustomBuildHook(BuildHookInterface): committer_date = committer_year = "unknown" try: cp = subprocess.run(["git", "log", "-n 1", "HEAD", "--format=%cs"], - capture_output=True, text=True) - except FileNotFoundError: - pass + capture_output=True, check=True, text=True) + except (FileNotFoundError, subprocess.CalledProcessError): + # support building wheel from sdist + if Path(*RELEASE_PY).is_file(): + self.app.display_warning("_release.py already exists") + return else: if cp and cp.stdout: committer_date = cp.stdout.strip()