Skip to content

Commit 2edc67a

Browse files
Fix Windows Attempt
1 parent ef78f42 commit 2edc67a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

variantlib/plugins/py_backends.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
import logging
66
import os
77
import pathlib
8+
import random
89
import shutil
10+
import string
911
import subprocess
1012
import sys
1113
import tempfile
@@ -77,13 +79,12 @@ def prepare_requirements(
7779
"""
7880
# pip does not honour environment markers in command line arguments
7981
# 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+
)
8788

8889
with req_file.open("w", encoding="utf-8") as rf:
8990
rf.write(os.linesep.join(requirements))

0 commit comments

Comments
 (0)