File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 5
5
import logging
6
6
import os
7
7
import pathlib
8
+ import random
8
9
import shutil
10
+ import string
9
11
import subprocess
10
12
import sys
11
13
import tempfile
@@ -77,13 +79,12 @@ def prepare_requirements(
77
79
"""
78
80
# pip does not honour environment markers in command line arguments
79
81
# but it does from requirement files.
80
- with tempfile .NamedTemporaryFile (
81
- "w" ,
82
- prefix = "variants-plugins-reqs-" ,
83
- suffix = ".txt" ,
84
- encoding = "utf-8" ,
85
- ) as _req_file :
86
- req_file = pathlib .Path (_req_file .name )
82
+ with tempfile .TemporaryDirectory () as tmp_dir :
83
+ req_file = pathlib .Path (tmp_dir ) / (
84
+ "variants-plugins-reqs-"
85
+ f"{ '' .join (random .choice (string .ascii_letters ) for _ in range (12 ))} "
86
+ ".txt"
87
+ )
87
88
88
89
with req_file .open ("w" , encoding = "utf-8" ) as rf :
89
90
rf .write (os .linesep .join (requirements ))
You can’t perform that action at this time.
0 commit comments