Skip to content

Commit

Permalink
small changes in asn1ToC script
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbusch committed Nov 26, 2024
1 parent d44a8a2 commit f054453
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions utils/codegen/asn1ToC/asn1ToC.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@
# SOFTWARE.
# ==============================================================================

from math import ceil
from multiprocessing import Pool

import argparse
import glob
import os
import re
import shutil
import subprocess
import tempfile
from math import ceil
from multiprocessing import Pool

def parseCli():
"""Parses script's CLI arguments.
Expand All @@ -56,7 +55,16 @@ def parseCli():

return args

def process_file(args):
def adjustIncludesInFile(args):
"""
Adjusts the include statements in a file by adding a prefix to the included headers.
Args:
args (tuple): A tuple containing the file path, list of headers, and prefix.
Returns:
None
"""
file, headers, prefix = args
with open(file, "r") as f:
contents = f.read()
Expand Down Expand Up @@ -84,7 +92,7 @@ def adjustIncludes(parent_path: str):
# Use multiprocessing to process files in parallel
with Pool() as pool:
pool = Pool(ceil(os.cpu_count()*0.8))
pool.map(process_file, files_to_process)
pool.map(adjustIncludesInFile, files_to_process)

def main():

Expand Down

0 comments on commit f054453

Please sign in to comment.