Skip to content

Commit

Permalink
[fix][fn] Make python install dependencies from requirements.txt (apa…
Browse files Browse the repository at this point in the history
…che#20174)

Co-authored-by: tison <[email protected]>
(cherry picked from commit e8f89cb)
  • Loading branch information
jiangpengcheng authored and srinath-ctds committed Aug 12, 2024
1 parent 13b6669 commit 9eca32d
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,15 @@ def main():
zpfile.extractall(os.path.dirname(str(args.py)))
basename = os.path.basename(os.path.splitext(str(args.py))[0])

requirements_file = os.path.join(os.path.dirname(str(args.py)), basename, "requirements.txt")
if os.path.isfile(requirements_file):
cmd = "pip install -r %s" % requirements_file
Log.debug("Install python dependencies via cmd: %s" % cmd)
retval = os.system(cmd)
if retval != 0:
print("Could not install user depedencies specified by the requirements.txt file")
sys.exit(1)

deps_dir = os.path.join(os.path.dirname(str(args.py)), basename, "deps")

if os.path.isdir(deps_dir) and os.listdir(deps_dir):
Expand Down

0 comments on commit 9eca32d

Please sign in to comment.