@@ -407,7 +407,16 @@ def writeSpec(args):
407407 pass
408408 else :
409409 icon_path = ""
410-
410+ exclude_files_str = ""
411+ try :
412+ exclude_files_list = str_to_list (args .exclude_files )
413+ if len (exclude_files_list ) > 0 :
414+ exclude_files_str = exclude_files_str + "a.binaries = a.binaries - TOC([\n "
415+ for exclude_file in exclude_files_list :
416+ exclude_files_str = exclude_files_str + "\t ('{}',None, None),\n " .format (exclude_file )
417+ exclude_files_str = exclude_files_str + "])\n "
418+ except :
419+ pass
411420 if getOperationSystem () == "Darwin" :
412421 with open ("{}.spec" .format (get_app_name (args )), "wb" ) as f :
413422 f .write (("# -*- mode: python ; coding: utf-8 -*-\n \n \n "
@@ -425,6 +434,7 @@ def writeSpec(args):
425434 "\t \t \t win_private_assemblies=False,\n "
426435 "\t \t \t cipher=block_cipher,\n "
427436 "\t \t \t noarchive=False)\n "
437+ "{}\n "
428438 "pyz = PYZ(a.pure, a.zipped_data,\n "
429439 "\t \t \t cipher=block_cipher)\n \n "
430440 "exe = EXE(pyz,\n "
@@ -448,7 +458,10 @@ def writeSpec(args):
448458 "\t \t \t name='{}.app',\n "
449459 "\t \t \t icon='{}',\n "
450460 "\t \t \t bundle_identifier=None,\n "
451- "\t \t \t info_plist = " .format (get_app_name (args ), binaries_str , data_str ,
461+ "\t \t \t info_plist = " .format (get_app_name (args ),
462+ binaries_str ,
463+ data_str ,
464+ exclude_files_str ,
452465 get_app_name (args ), icon_path , get_app_name (args ), icon_path ) +
453466 "{\n \t \t \t \t \t \t \t 'NSHighResolutionCapable':'True','CFBundleShortVersionString':" + "'{}'" .format (
454467 args .app_version [:- 2 ])
@@ -470,6 +483,7 @@ def writeSpec(args):
470483 " win_private_assemblies=False,\n "
471484 " cipher=block_cipher,\n "
472485 " noarchive=False)\n "
486+ "{}"
473487 "pyz = PYZ(a.pure, a.zipped_data,\n "
474488 " cipher=block_cipher)\n "
475489 "exe2 = EXE(pyz,\n "
@@ -491,7 +505,11 @@ def writeSpec(args):
491505 " strip=False,\n "
492506 " upx=True,\n "
493507 " upx_exclude=[],\n "
494- " name='{}')\n " .format (get_app_name (args ), binaries_str , data_str , get_app_name (args ),
508+ " name='{}')\n " .format (get_app_name (args ),
509+ binaries_str ,
510+ data_str ,
511+ exclude_files_str ,
512+ get_app_name (args ),
495513 args .console , icon_path ,
496514 get_app_name (args )).encode ("utf-8" ))
497515 else :
0 commit comments