Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nvidia-patch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
nvidia-patch
Commits
6ba68962
Commit
6ba68962
authored
Sep 14, 2019
by
Snawoot
Committed by
GitHub
Sep 14, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #158 from Snawoot/ap_direct
ap: direct mode
parents
8490006b
0f12e20b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
win/tools/autopatch/autopatch.py
win/tools/autopatch/autopatch.py
+19
-9
No files found.
win/tools/autopatch/autopatch.py
View file @
6ba68962
...
@@ -44,6 +44,10 @@ def parse_args():
...
@@ -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,13 +117,18 @@ def make_patch(archive, *,
...
@@ -113,13 +117,18 @@ def make_patch(archive, *,
arch_tgt
,
arch_tgt
,
search
,
search
,
replacement
,
replacement
,
sevenzip
=
"7z"
):
sevenzip
=
"7z"
,
with
tempfile
.
TemporaryDirectory
()
as
tmpdir
:
direct
=
False
):
with
ExtractedTarget
(
archive
,
if
direct
:
tmpdir
,
with
open
(
archive
,
'rb'
)
as
fo
:
arch_tgt
,
f
=
fo
.
read
()
sevenzip
=
sevenzip
)
as
tgt
:
else
:
f
=
expand
(
tgt
,
sevenzip
=
sevenzip
)
with
tempfile
.
TemporaryDirectory
()
as
tmpdir
:
with
ExtractedTarget
(
archive
,
tmpdir
,
arch_tgt
,
sevenzip
=
sevenzip
)
as
tgt
:
f
=
expand
(
tgt
,
sevenzip
=
sevenzip
)
offset
=
f
.
find
(
search
)
offset
=
f
.
find
(
search
)
del
f
del
f
if
offset
==
-
1
:
if
offset
==
-
1
:
...
@@ -160,9 +169,10 @@ def main():
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment