Commit a4fda77f authored by canterburym's avatar canterburym
Browse files

Reverting accidental change to asn_process.py

parent 1312f9ff
Loading
Loading
Loading
Loading
Loading
+1 −28
Original line number Diff line number Diff line
@@ -68,28 +68,6 @@ def syntaxCheckASN (fileList):
            }
    return results


duplicateObjects = {
    '102232-1/LI-PS-PDU.asn' : [
        'CCPayload',
        'IRIPayload',
        'Location'
    ],
    'testing/mod1.asn' : [
        'ClashField'
    ]
}
def fixDuplicateObjects(filename):
    stringContent = filename.read_text()
    for object in duplicateObjects[filename.as_posix()]:
        stringContent = stringContent.replace(f'{object} ::=', f'Native{object} ::=')
        stringContent = stringContent.replace(f'SEQUENCE OF {object}', f'SEQUENCE OF Native{object}')
        #stringContent = sub(f"]\\w{object}", f"] Native{object}", stringContent)

    Path('temp.asn').write_text(stringContent)
    return 'temp.asn'


def compileAllTargets (compileTargets):
    """
    Attempts to compile a set of compile targets using the pycrate ASN1 tools
@@ -118,11 +96,6 @@ def compileAllTargets (compileTargets):
            GLOBAL.clear()
            for filename in target:
                pFile = Path(filename)
                if pFile.as_posix() in duplicateObjects:
                    tmpFile = Path(fixDuplicateObjects(pFile))
                    fileTexts.append(tmpFile.read_text())
                    #tmpFile.unlink()
                else:
                fileTexts.append(pFile.read_text())
                fileNames.append(filename)
                logging.debug (f"  Loading {filename}")