mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 13:54: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 re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from tempfile import TempNamedDir
|
from tempfile import TemporaryDirectory
|
||||||
|
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ print("Discovered packages:", packages)
|
||||||
torch = "torch==2.2.2"
|
torch = "torch==2.2.2"
|
||||||
pytorch_url = None
|
pytorch_url = None
|
||||||
|
|
||||||
with TempNamedDir(prefix="pytorch_download_") as temp_dir:
|
with TemporaryDirectory(prefix="pytorch_download_") as temp_dir:
|
||||||
cmd = [
|
cmd = [
|
||||||
sys.executable,
|
sys.executable,
|
||||||
"-m",
|
"-m",
|
||||||
|
@ -32,7 +32,7 @@ with TempNamedDir(prefix="pytorch_download_") as temp_dir:
|
||||||
torch,
|
torch,
|
||||||
"--no-deps",
|
"--no-deps",
|
||||||
"--dest",
|
"--dest",
|
||||||
temp_dir.name,
|
temp_dir,
|
||||||
"--index-url",
|
"--index-url",
|
||||||
"https://download.pytorch.org/whl/cpu",
|
"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)
|
url_match = re.search(r"Downloading (https://download\.pytorch\.org/[^\s]+\.whl)", line)
|
||||||
if url_match:
|
if url_match:
|
||||||
pytorch_url = url_match.group(1)
|
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}")
|
print(f"PyTorch URL: {pytorch_url}")
|
||||||
process.terminate() # Terminate the subprocess
|
process.terminate() # Terminate the subprocess
|
||||||
break
|
break
|
||||||
|
@ -57,9 +61,9 @@ else:
|
||||||
print("PyTorch URL not found in the output")
|
print("PyTorch URL not found in the output")
|
||||||
requirements = [torch] + requirements
|
requirements = [torch] + requirements
|
||||||
|
|
||||||
print(requirements)
|
#print(requirements)
|
||||||
|
|
||||||
sys.exit()
|
#sys.exit()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="aider-chat",
|
name="aider-chat",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue