@@ -301,6 +301,9 @@ def render_function(function: Function, opts: Opts, github_data: GithubData):
301
301
lines = expand_macros (name , function ._body , opts , github , github_data )
302
302
head = []
303
303
append_path_var (opts , head )
304
+ #print('render_function', function._name, opts.need_patch_var)
305
+ if opts .need_patch_var :
306
+ head += expand_macros (name , ['PATCH = find_app(C:\\ Program Files\\ Git\\ usr\\ bin\\ patch.exe)\n ' ], opts )
304
307
lines = head + lines
305
308
lines = [re .sub ('[ ]+$' , '' , line ) for line in lines ] # replace trailing spaces
306
309
res .append (":{}_begin\n " .format (name ))
@@ -552,6 +555,8 @@ def macro_download(name, args, kwargs, ret, opts: Opts, ctx: Ctx, githubdata: Gi
552
555
553
556
verbose = kwarg_value (kwargs , 'verbose' , 'v' )
554
557
558
+ test = kwarg_value (kwargs , 'test' , 't' )
559
+
555
560
if opts .env_policy and not ctx .github :
556
561
curl = '"%CURL%"'
557
562
opts .need_curl_var = True
@@ -601,6 +606,9 @@ def spacejoin_nonempty(*vs):
601
606
exp = "if not exist {} (\n echo downloading {}\n {}\n )\n " .format (quoted (dest ), os .path .basename (url ), cmd )
602
607
else :
603
608
exp = "if not exist {} {}\n " .format (quoted (dest ), cmd )
609
+
610
+ if test and os .path .splitext (dest )[1 ].lower () in ['.7z' , '.zip' ]:
611
+ exp = '7z t {} > NUL || del /f {}\n ' .format (quoted (dest ), quoted (dest )) + exp
604
612
elif shell == 'msys2' :
605
613
if cache is None :
606
614
exp = cmd
@@ -697,7 +705,7 @@ def macro_patch(name, args, kwargs, ret, opts: Opts, ctx: Ctx, githubdata: Githu
697
705
validate_args ("patch" , args , kwargs , ret , 1 , 1 , {"N" , "forward" , "p1" })
698
706
699
707
opts .use_patch = True
700
- if ( opts .env_policy and not ctx . github ) or opts .use_patch_var :
708
+ if opts .env_policy or opts .use_patch_var :
701
709
patch = '"%PATCH%"'
702
710
opts .need_patch_var = True
703
711
else :
0 commit comments