Replace vistir.compat.NamedTemporaryFile with STL

NamedTemporaryFile was introduced in Python 3.4.
We only support Python 3.7+, hence this goes away.
This commit is contained in:
Oz N Tiram
2022-04-23 14:52:38 +02:00
parent 9a6cf5db1a
commit 2bb915e16f
2 changed files with 7 additions and 3 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ import logging
import os
import shutil
import sys
import tempfile
import time
import warnings
from pathlib import Path
@@ -1440,7 +1441,7 @@ def write_requirement_to_file(
with_prefix=True, with_hashes=include_hashes, with_markers=True, as_list=False
)
f = vistir.compat.NamedTemporaryFile(
f = tempfile.NamedTemporaryFile(
prefix="pipenv-", suffix="-requirement.txt", dir=requirements_dir, delete=False
)
if project.s.is_verbose():
+5 -2
View File
@@ -943,10 +943,11 @@ def venv_resolve_deps(
"""
import json
import tempfile
from pipenv import resolver
from pipenv._compat import decode_for_output
from pipenv.vendor.vistir.compat import NamedTemporaryFile, Path
from pipenv.vendor.vistir.compat import Path
results = []
pipfile_section = "dev-packages" if dev else "packages"
@@ -975,7 +976,9 @@ def venv_resolve_deps(
cmd.append("--system")
if dev:
cmd.append("--dev")
target_file = NamedTemporaryFile(prefix="resolver", suffix=".json", delete=False)
target_file = tempfile.NamedTemporaryFile(
prefix="resolver", suffix=".json", delete=False
)
target_file.close()
cmd.extend(["--write", make_posix(target_file.name)])
with temp_environ():