Skip to content

Commit b6097f6

Browse files
committed
DependencyCompiler: add reqs parameter to .Download and .Wheel methods
1 parent 1786b5d commit b6097f6

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

comfy_cli/uv.py

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,12 @@ def Sync(
234234
@staticmethod
235235
def Download(
236236
cwd: PathLike,
237-
reqFile: list[PathLike],
238237
executable: PathLike = sys.executable,
239238
extraUrl: Optional[str] = None,
240239
noDeps: bool = False,
241240
out: Optional[PathLike] = None,
241+
reqs: Optional[list[str]] = None,
242+
reqFile: Optional[list[PathLike]] = None,
242243
) -> subprocess.CompletedProcess[Any]:
243244
"""For now, the `download` cmd has no uv support, so use pip"""
244245
cmd = [
@@ -248,12 +249,6 @@ def Download(
248249
"download",
249250
]
250251

251-
if isinstance(reqFile, (str, Path)):
252-
cmd.extend(["-r", str(reqFile)])
253-
elif isinstance(reqFile, list):
254-
for rf in reqFile:
255-
cmd.extend(["-r", str(rf)])
256-
257252
if extraUrl is not None:
258253
cmd.extend(["--extra-index-url", extraUrl])
259254

@@ -263,25 +258,32 @@ def Download(
263258
if out is not None:
264259
cmd.extend(["-d", str(out)])
265260

261+
if reqs is not None:
262+
cmd.extend(reqs)
263+
264+
if reqFile is not None:
265+
for rf in reqFile:
266+
cmd.extend(["--requirement", rf])
267+
266268
return _check_call(cmd, cwd)
267269

268270
@staticmethod
269271
def Wheel(
270272
cwd: PathLike,
271-
reqFile: list[PathLike],
272273
executable: PathLike = sys.executable,
273274
extraUrl: Optional[str] = None,
274275
noDeps: bool = False,
275276
out: Optional[PathLike] = None,
277+
reqs: Optional[list[str]] = None,
278+
reqFile: Optional[list[PathLike]] = None,
276279
) -> subprocess.CompletedProcess[Any]:
277280
"""For now, the `wheel` cmd has no uv support, so use pip"""
278-
cmd = [str(executable), "-m", "pip", "wheel"]
279-
280-
if isinstance(reqFile, (str, Path)):
281-
cmd.extend(["-r", str(reqFile)])
282-
elif isinstance(reqFile, list):
283-
for rf in reqFile:
284-
cmd.extend(["-r", str(rf)])
281+
cmd = [
282+
str(executable),
283+
"-m",
284+
"pip",
285+
"wheel",
286+
]
285287

286288
if extraUrl is not None:
287289
cmd.extend(["--extra-index-url", extraUrl])
@@ -292,6 +294,13 @@ def Wheel(
292294
if out is not None:
293295
cmd.extend(["-w", str(out)])
294296

297+
if reqs is not None:
298+
cmd.extend(reqs)
299+
300+
if reqFile is not None:
301+
for rf in reqFile:
302+
cmd.extend(["--requirement", rf])
303+
295304
return _check_call(cmd, cwd)
296305

297306
@staticmethod

0 commit comments

Comments
 (0)