MCPcopy Create free account
hub / github.com/PacktPublishing/3D-Graphics-Rendering-Cookbook / applyPatchFile

Function applyPatchFile

deps/bootstrap.py:372–389  ·  view source on GitHub ↗
(patch_name, dir_name, pnum)

Source from the content-addressed store, hash-verified

370
371
372def applyPatchFile(patch_name, dir_name, pnum):
373 # we're assuming the patch was applied like in this example:
374 # diff --exclude=".git" --exclude=".hg" -rupN ./src/AGAST/ ./src/AGAST_patched/ > ./patches/agast.patch
375 # where the first given location is the unpatched directory, and the second location is the patched directory.
376 log("Applying patch to " + dir_name)
377 patch_dir = os.path.join(BASE_DIR, "patches")
378 arguments = "-d " + os.path.join(SRC_DIR, dir_name) + " -p" + str(pnum) + " < " + os.path.join(patch_dir, patch_name)
379 argumentsBinary = "-d " + os.path.join(SRC_DIR, dir_name) + " -p" + str(pnum) + " --binary < " + os.path.join(patch_dir, patch_name)
380 res = executeCommand(TOOL_COMMAND_PATCH + " --dry-run " + arguments, quiet = True)
381 if res != 0:
382 arguments = argumentsBinary
383 res = executeCommand(TOOL_COMMAND_PATCH + " --dry-run " + arguments, quiet = True)
384 if res != 0:
385 log("ERROR: patch application failure; has this patch already been applied?")
386 executeCommand(TOOL_COMMAND_PATCH + " --dry-run " + arguments, printCommand = True)
387 exit(255)
388 else:
389 dieIfNonZero(executeCommand(TOOL_COMMAND_PATCH + " " + arguments, quiet = True))
390
391
392def runPythonScript(script_name):

Callers 1

mainFunction · 0.85

Calls 3

logFunction · 0.85
executeCommandFunction · 0.85
dieIfNonZeroFunction · 0.85

Tested by

no test coverage detected