File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 5
5
import shutil
6
6
import sys
7
7
import tarfile
8
- import tempfile
9
8
import textwrap
10
9
from pathlib import Path
11
10
from tempfile import mkdtemp
@@ -130,8 +129,8 @@ def main() -> None:
130
129
return
131
130
132
131
# Tarfile builds require extraction and changing the directory
133
- with tempfile . TemporaryDirectory ( prefix = "cibw-sdist-" ) as temp_dir_str :
134
- temp_dir = Path ( temp_dir_str )
132
+ temp_dir = Path ( mkdtemp ( prefix = "cibw-sdist-" )). resolve ( strict = True )
133
+ try :
135
134
with tarfile .open (args .package_dir ) as tar :
136
135
tar .extractall (path = temp_dir )
137
136
@@ -146,6 +145,12 @@ def main() -> None:
146
145
147
146
with chdir (temp_dir ):
148
147
build_in_directory (args )
148
+ finally :
149
+ # avoid https://github.com/python/cpython/issues/86962 by performing
150
+ # cleanup manually
151
+ shutil .rmtree (temp_dir , ignore_errors = sys .platform .startswith ("win" ))
152
+ if temp_dir .exists ():
153
+ log .warning (f"Can't delete temporary folder '{ str (temp_dir )} '" )
149
154
150
155
151
156
def build_in_directory (args : CommandLineArguments ) -> None :
@@ -253,6 +258,8 @@ def build_in_directory(args: CommandLineArguments) -> None:
253
258
else :
254
259
assert_never (platform )
255
260
finally :
261
+ # avoid https://github.com/python/cpython/issues/86962 by performing
262
+ # cleanup manually
256
263
shutil .rmtree (tmp_path , ignore_errors = sys .platform .startswith ("win" ))
257
264
if tmp_path .exists ():
258
265
log .warning (f"Can't delete temporary folder '{ str (tmp_path )} '" )
You can’t perform that action at this time.
0 commit comments