Skip to content

Commit

Permalink
fontgen: assume plain .patch for single string patch
Browse files Browse the repository at this point in the history
  • Loading branch information
yehoshuapw authored and JF002 committed May 10, 2022
1 parent 8b2e1c6 commit 27e598f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/displayapp/fonts/fonts.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"bpp": 1,
"size": 20,
"patches": [["patch", "{file}", "{file}_zero.patch"]]
"patches": ["{file}_zero.patch"]
},
"jetbrains_mono_42": {
"sources": [
Expand Down
15 changes: 11 additions & 4 deletions src/displayapp/fonts/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,18 @@ def main():
subprocess.check_call(line)
if patches:
for patch in patches:
try: patch = patch.format(name=name, file=name+'.c')
try:
# Try and patch, if given a string
patch = patch.format(name=name, file=name+'.c')
subprocess.check_call(['/usr/bin/patch', name+'.c', patch])
continue
except: pass
try: patch = [arg.format(name=name, file=name+'.c') for arg in patch]
except: pass
subprocess.check_call(patch)
try:
# otherwise, assume a "advanced" patch, which is a list of strings.
patch = [arg.format(name=name, file=name+'.c') for arg in patch]
subprocess.check_call(patch)
except Exception as e:
sys.exit('Failed to patch using "{patch}"\n{err}'.format(patch=patch,err=e))



Expand Down

0 comments on commit 27e598f

Please sign in to comment.