summarylogtreecommitdiffstats
path: root/build-ac.index-in-tmp.diff
blob: 84f35f3071fd1bb8dc79533d01e8021f11bbb0b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--- a/backends/pep517.py	2025-03-27 22:59:27.503461878 -0700
+++ b/backends/pep517.py	2025-03-27 23:00:56.860222831 -0700
@@ -33,6 +33,7 @@
 import shutil
 import sys
 import tarfile
+import tempfile
 import zipfile
 from pathlib import Path
 
@@ -216,14 +217,16 @@
 
 
 def _build_and_inject_ac_index(build_dir, extracted_wheel_dir):
-    ac_index_build_name = _build_ac_index(build_dir)
+    ac_index_dir = tempfile.mkdtemp()
+    ac_index_build_name = _build_ac_index(ac_index_dir)
     extracted_ac_index = os.path.join(extracted_wheel_dir, AC_INDEX_REL_PATH)
     _remove_file_if_exists(extracted_ac_index)
     print("Adding auto-complete index into wheel")
-    os.rename(
+    shutil.copy2(
         ac_index_build_name,
         extracted_ac_index,
     )
+    shutil.rmtree(ac_index_dir)
 
 
 def _build_ac_index(build_dir, rebuild=True):