From c51ec08c8250bb29883dcb63f24f870b7263ddc0 Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Thu, 31 Oct 2024 08:53:03 +0100 Subject: [PATCH] Fix concurrent install There's some file manipulation going on during installation of the package. Since we've shifted CI to run unit tests in parallel, and therefore install the package in parallel, we've seen flakiness stemming from this race condition. --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a5e8e5a64..cd3e6d83c 100755 --- a/setup.py +++ b/setup.py @@ -69,6 +69,8 @@ def change_project_name(new_name): fd.seek(0) pyproject = tomlkit.parse(fd.read()) old_name = pyproject["project"]["name"] + if old_name == new_name: + return None pyproject["project"]["name"] = new_name fd.seek(0) fd.truncate() @@ -82,7 +84,8 @@ def changed_package_name(new_name): try: yield finally: - change_project_name(old_name) + if old_name is not None: + change_project_name(old_name) with changed_package_name(package):