Skip to content

Commit

Permalink
Find_Req_Files now returns at most one requirements file per dir
Browse files Browse the repository at this point in the history
- prioritizes based on the order of names in `DependencyCompiler.reqNames`
  • Loading branch information
telamonian committed Sep 16, 2024
1 parent 3d9b73e commit bc105ad
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions comfy_cli/uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,28 @@ class DependencyCompiler:
"""
).strip()

reqNames = {
reqNames = (
"requirements.txt",
"pyproject.toml",
"setup.cfg",
"setup.py",
}
)

@staticmethod
def Find_Req_Files(*ders: PathLike) -> list[Path]:
return [
file # fmt: skip
for der in ders
for file in Path(der).absolute().iterdir()
if file.name in DependencyCompiler.reqNames
]
reqFiles = []
for der in ders:
reqFound = False
for reqName in DependencyCompiler.reqNames:
for file in Path(der).absolute().iterdir():
if file.name == reqName:
reqFiles.append(file)
reqFound = True
break
if reqFound:
break

return reqFiles

@staticmethod
def Install_Build_Deps(executable: PathLike = sys.executable):
Expand Down

0 comments on commit bc105ad

Please sign in to comment.