mirror of
https://github.com/keylase/nvidia-patch.git
synced 2024-11-23 05:57:21 +00:00
ap: direct mode
This commit is contained in:
parent
8490006b82
commit
0f12e20b91
@ -44,6 +44,10 @@ def parse_args():
|
|||||||
parser.add_argument("-o", "--stdout",
|
parser.add_argument("-o", "--stdout",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="output into stdout")
|
help="output into stdout")
|
||||||
|
parser.add_argument("-D", "--direct",
|
||||||
|
action="store_true",
|
||||||
|
help="supply patched library directly instead of "
|
||||||
|
"installer file. Implies --stdout option.")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
return args
|
return args
|
||||||
|
|
||||||
@ -113,7 +117,12 @@ def make_patch(archive, *,
|
|||||||
arch_tgt,
|
arch_tgt,
|
||||||
search,
|
search,
|
||||||
replacement,
|
replacement,
|
||||||
sevenzip="7z"):
|
sevenzip="7z",
|
||||||
|
direct=False):
|
||||||
|
if direct:
|
||||||
|
with open(archive, 'rb') as fo:
|
||||||
|
f = fo.read()
|
||||||
|
else:
|
||||||
with tempfile.TemporaryDirectory() as tmpdir:
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
with ExtractedTarget(archive,
|
with ExtractedTarget(archive,
|
||||||
tmpdir,
|
tmpdir,
|
||||||
@ -160,9 +169,10 @@ def main():
|
|||||||
arch_tgt=args.target,
|
arch_tgt=args.target,
|
||||||
search=search,
|
search=search,
|
||||||
replacement=replacement,
|
replacement=replacement,
|
||||||
sevenzip=args.sevenzip)
|
sevenzip=args.sevenzip,
|
||||||
|
direct=args.direct)
|
||||||
patch_content = format_patch(patch, args.target_name)
|
patch_content = format_patch(patch, args.target_name)
|
||||||
if args.stdout:
|
if args.stdout or args.direct:
|
||||||
with open(sys.stdout.fileno(), mode='wb', closefd=False) as out:
|
with open(sys.stdout.fileno(), mode='wb', closefd=False) as out:
|
||||||
out.write(patch_content)
|
out.write(patch_content)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user