You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ti...@apache.org on 2023/10/18 01:57:54 UTC
[pulsar] branch master updated: [fix][fn] Make python install dependencies from requirements.txt (#20174)
This is an automated email from the ASF dual-hosted git repository.
tison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 187e0cf5708 [fix][fn] Make python install dependencies from requirements.txt (#20174)
187e0cf5708 is described below
commit 187e0cf5708b358b844a8b3575ae6e350a39238b
Author: jiangpengcheng <sc...@gmail.com>
AuthorDate: Wed Oct 18 09:57:47 2023 +0800
[fix][fn] Make python install dependencies from requirements.txt (#20174)
Co-authored-by: tison <wa...@gmail.com>
---
.../instance/src/main/python/python_instance_main.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/pulsar-functions/instance/src/main/python/python_instance_main.py b/pulsar-functions/instance/src/main/python/python_instance_main.py
index 9a923c7e3a1..943e1c1c245 100755
--- a/pulsar-functions/instance/src/main/python/python_instance_main.py
+++ b/pulsar-functions/instance/src/main/python/python_instance_main.py
@@ -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):