Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paginate hex files every 80 characters #76

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion clvm_tools/clvmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def compile_clvm(input_path, output_path, search_paths=[]):
hex = result.as_bin().hex()

with open(output_path, "w") as f:
f.write(hex)
f.write(insert_newlines(hex))
f.write("\n")
else:
log.info("skipping %s, compiled recently" % input_path)
Expand All @@ -48,3 +48,9 @@ def find_files(path=""):
compile_clvm(full_path, target)
r.append(target)
return r

def insert_newlines(string, every=80):
lines = []
for i in range(0, len(string), every):
lines.append(string[i:i+every])
return '\n'.join(lines)