1313import tempfile
1414import zipfile
1515
16- def build (src_dir , output_path ):
16+ def build (src_dir , output_path , install_dependencies ):
1717 with tempfile .TemporaryDirectory () as build_dir :
1818 copy_tree (src_dir , build_dir )
1919 if os .path .exists (os .path .join (src_dir , 'requirements.txt' )):
@@ -24,7 +24,8 @@ def build(src_dir, output_path):
2424 'install' ,
2525 '--ignore-installed' ,
2626 '--target' , build_dir ,
27- '-r' , os .path .join (build_dir , 'requirements.txt' )],
27+ '-r' , os .path .join (build_dir , 'requirements.txt' ),
28+ * (['--no-deps' ] if install_dependencies == 'false' else [])],
2829 check = True ,
2930 stdout = subprocess .DEVNULL ,
3031 )
@@ -71,5 +72,5 @@ def get_hash(output_path):
7172 logging .basicConfig (level = 'DEBUG' )
7273 query = json .loads (sys .stdin .read ())
7374 logging .debug (query )
74- archive = build (query ['src_dir' ], query ['output_path' ])
75- print (json .dumps ({'archive' : archive , " base64sha256" :get_hash (archive )}))
75+ archive = build (query ['src_dir' ], query ['output_path' ], query [ 'install_dependencies' ] )
76+ print (json .dumps ({'archive' : archive , ' base64sha256' :get_hash (archive )}))
0 commit comments