mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 21:34:59 +00:00
Updated the TempNamedDir usage to TemporaryDirectory in the setup.py file.
This commit is contained in:
parent
f568c45f6b
commit
1d2ade748c
1 changed files with 9 additions and 5 deletions
14
setup.py
14
setup.py
|
@ -1,7 +1,7 @@
|
|||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from tempfile import TempNamedDir
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
|
@ -23,7 +23,7 @@ print("Discovered packages:", packages)
|
|||
torch = "torch==2.2.2"
|
||||
pytorch_url = None
|
||||
|
||||
with TempNamedDir(prefix="pytorch_download_") as temp_dir:
|
||||
with TemporaryDirectory(prefix="pytorch_download_") as temp_dir:
|
||||
cmd = [
|
||||
sys.executable,
|
||||
"-m",
|
||||
|
@ -32,7 +32,7 @@ with TempNamedDir(prefix="pytorch_download_") as temp_dir:
|
|||
torch,
|
||||
"--no-deps",
|
||||
"--dest",
|
||||
temp_dir.name,
|
||||
temp_dir,
|
||||
"--index-url",
|
||||
"https://download.pytorch.org/whl/cpu",
|
||||
]
|
||||
|
@ -44,6 +44,10 @@ with TempNamedDir(prefix="pytorch_download_") as temp_dir:
|
|||
url_match = re.search(r"Downloading (https://download\.pytorch\.org/[^\s]+\.whl)", line)
|
||||
if url_match:
|
||||
pytorch_url = url_match.group(1)
|
||||
url_match = re.search(r"Using cached (https://download\.pytorch\.org/[^\s]+\.whl)", line)
|
||||
if url_match:
|
||||
pytorch_url = url_match.group(1)
|
||||
if pytorch_url:
|
||||
print(f"PyTorch URL: {pytorch_url}")
|
||||
process.terminate() # Terminate the subprocess
|
||||
break
|
||||
|
@ -57,9 +61,9 @@ else:
|
|||
print("PyTorch URL not found in the output")
|
||||
requirements = [torch] + requirements
|
||||
|
||||
print(requirements)
|
||||
#print(requirements)
|
||||
|
||||
sys.exit()
|
||||
#sys.exit()
|
||||
|
||||
setup(
|
||||
name="aider-chat",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue