MCPcopy Create free account
hub / github.com/cztomczak/cefpython / update_cef_patches

Function update_cef_patches

tools/automate.py:331–367  ·  view source on GitHub ↗

Update cef/patch/ directory with CEF Python patches. Issue73 is applied in getenv() by setting appropriate env var. Note that this modifies only cef_build_dir/cef/ directory. If the build was run previously then there is a copy of the cef/ directory in the cef_build_dir/chromium/ di

()

Source from the content-addressed store, hash-verified

329
330
331def update_cef_patches():
332 """Update cef/patch/ directory with CEF Python patches.
333 Issue73 is applied in getenv() by setting appropriate env var.
334
335 Note that this modifies only cef_build_dir/cef/ directory. If the
336 build was run previously then there is a copy of the cef/ directory
337 in the cef_build_dir/chromium/ directory which is not being updated.
338 """
339 print("[automate.py] Updating CEF patches with CEF Python patches")
340 cef_dir = os.path.join(Options.cef_build_dir, "cef")
341 cef_patch_dir = os.path.join(cef_dir, "patch")
342 cef_patches_dir = os.path.join(cef_patch_dir, "patches")
343
344 # Copy src/patches/*.patch to cef/patch/patches/
345 cefpython_patches_dir = os.path.join(Options.cefpython_dir, "patches")
346 cefpython_patches = glob.glob(os.path.join(cefpython_patches_dir,
347 "*.patch"))
348 for file_ in cefpython_patches:
349 print("[automate.py] Copying %s to %s"
350 % (os.path.basename(file_), cef_patches_dir))
351 shutil.copy(file_, cef_patches_dir)
352
353 # Append cefpython/patches/patch.py to cef/patch/patch.cfg
354 cef_patch_cfg = os.path.join(cef_patch_dir, "patch.cfg")
355 print("[automate.py] Overwriting %s" % cef_patch_cfg)
356 with open(cef_patch_cfg, "rb") as fp:
357 cef_patch_cfg_contents = fp.read().decode("utf-8")
358 cef_patch_cfg_contents += "\n"
359 cefpython_patch_cfg = os.path.join(cefpython_patches_dir, "patch.py")
360 with open(cefpython_patch_cfg, "rb") as fp:
361 cefpython_patch_cfg_contents = fp.read().decode("utf-8")
362 with open(cef_patch_cfg, "wb") as fp:
363 cef_patch_cfg_contents = cef_patch_cfg_contents.replace("\r\n", "\n")
364 cefpython_patch_cfg_contents = cefpython_patch_cfg_contents.replace(
365 "\r\n", "\n")
366 new_contents = cef_patch_cfg_contents + cefpython_patch_cfg_contents
367 fp.write(new_contents.encode("utf-8"))
368
369
370def build_cef_projects():

Callers 1

create_cef_directoriesFunction · 0.85

Calls 1

copyMethod · 0.80

Tested by

no test coverage detected