44447. Reduce packages size (Issue #321). After packing prebuilt binaries,
4545 reduce its size so that packages will use the reduced prebuilt binaries.
46468. Build cefpython modules for all supported Python versions on both
47- 32-bit and 64-bit
47+ 32-bit and 64-bit. Backup and restore subprocess executable on Windows
48+ built with Python 2.7 (Issue #342).
48499. Make setup installers and pack them to zip (Win/Mac) or .tar.gz (Linux)
495010. Make wheel packages
505111. Move setup and wheel packages to the build/distrib/ directory
@@ -129,7 +130,8 @@ def main():
129130 reduce_package_size_issue_262 ("64bit" )
130131 remove_unnecessary_package_files ("64bit" )
131132 if not NO_REBUILD :
132- build_cefpython_modules (pythons_32bit + pythons_64bit )
133+ build_cefpython_modules (pythons_32bit , "32bit" )
134+ build_cefpython_modules (pythons_64bit , "64bit" )
133135 if pythons_32bit :
134136 make_packages (pythons_32bit [0 ], "32bit" )
135137 if pythons_64bit :
@@ -439,7 +441,7 @@ def remove_unnecessary_package_files(arch):
439441 delete_cef_sample_apps (caller_script = __file__ , bin_dir = bin_dir )
440442
441443
442- def build_cefpython_modules (pythons ):
444+ def build_cefpython_modules (pythons , arch ):
443445 for python in pythons :
444446 print ("[build_distrib.py] Build cefpython module for {python_name}"
445447 .format (python_name = python ["name" ]))
@@ -461,14 +463,62 @@ def build_cefpython_modules(pythons):
461463 sys .exit (1 )
462464 print ("[build_distrib.py] Built successfully cefpython module for"
463465 " {python_name}" .format (python_name = python ["name" ]))
464- print ("[build_distrib.py] Successfully built cefpython modules for"
465- " all Python versions" )
466+ # Issue #342
467+ backup_subprocess_executable_issue342 (python )
468+
469+ # Issue #342
470+ restore_subprocess_executable_issue342 (arch )
471+
472+ print ("[build_distrib.py] Successfully built cefpython modules for {arch}"
473+ .format (arch = arch ))
474+
475+
476+ def backup_subprocess_executable_issue342 (python ):
477+ """Use subprocess executable build by Python 2.7 to avoid
478+ false-positives by AVs when building subprocess with Python 3.
479+ Windows-only issue."""
480+ if not WINDOWS :
481+ return
482+ if python ["version2" ] == (2 , 7 ):
483+ print ("[build_distrib.py] Backup subprocess executable built"
484+ " with Python 2.7 (Issue #342)" )
485+ cefpython_binary_basename = get_cefpython_binary_basename (
486+ get_os_postfix2_for_arch (python ["arch" ]))
487+ cefpython_binary = os .path .join (BUILD_DIR , cefpython_binary_basename )
488+ assert os .path .isdir (cefpython_binary )
489+ src = os .path .join (cefpython_binary , "subprocess.exe" )
490+ dst = os .path .join (BUILD_CEFPYTHON ,
491+ "subprocess_py27_{arch}_issue342.exe"
492+ .format (arch = python ["arch" ]))
493+ shutil .copy (src , dst )
494+
495+
496+ def restore_subprocess_executable_issue342 (arch ):
497+ """Use subprocess executable build by Python 2.7 to avoid
498+ false-positives by AVs when building subprocess with Python 3.
499+ Windows-only issue."""
500+ if not WINDOWS :
501+ return
502+ print ("[build_distrib.py] Restore subprocess executable built"
503+ " with Python 2.7 (Issue #342)" )
504+ cefpython_binary_basename = get_cefpython_binary_basename (
505+ get_os_postfix2_for_arch (arch ))
506+ cefpython_binary = os .path .join (BUILD_DIR , cefpython_binary_basename )
507+ assert os .path .isdir (cefpython_binary )
508+ src = os .path .join (BUILD_CEFPYTHON ,
509+ "subprocess_py27_{arch}_issue342.exe"
510+ .format (arch = arch ))
511+ assert os .path .isfile (src )
512+ dst = os .path .join (cefpython_binary , "subprocess.exe" )
513+ shutil .copy (src , dst )
466514
467515
468516def make_packages (python , arch ):
469- # Make setup package
517+ """ Make setup and wheel packages."""
470518 print ("[build_distrib.py] Make setup package for {arch}..."
471519 .format (arch = arch ))
520+
521+ # Call make_installer.py
472522 make_installer_py = os .path .join (TOOLS_DIR , "make_installer.py" )
473523 installer_command = ("\" {python}\" {make_installer_py} {version}"
474524 .format (python = python ["executable" ],
0 commit comments