13
13
import tempfile
14
14
import zipfile
15
15
16
- def build (src_dir , output_path ):
16
+ def build (src_dir , output_path , install_dependencies ):
17
17
with tempfile .TemporaryDirectory () as build_dir :
18
18
copy_tree (src_dir , build_dir )
19
19
if os .path .exists (os .path .join (src_dir , 'requirements.txt' )):
@@ -24,7 +24,8 @@ def build(src_dir, output_path):
24
24
'install' ,
25
25
'--ignore-installed' ,
26
26
'--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 [])],
28
29
check = True ,
29
30
stdout = subprocess .DEVNULL ,
30
31
)
@@ -71,5 +72,5 @@ def get_hash(output_path):
71
72
logging .basicConfig (level = 'DEBUG' )
72
73
query = json .loads (sys .stdin .read ())
73
74
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