mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
WIP functions processing
This commit is contained in:
@ -12,12 +12,13 @@ def emit_license(module: ir.Module, license_str: str):
|
||||
|
||||
gvar.align = 1 # type: ignore
|
||||
gvar.linkage = "dso_local" # type: ignore
|
||||
gvar.global_constant = False # must be global, not constant
|
||||
gvar.global_constant = False
|
||||
gvar.section = "license" # type: ignore
|
||||
|
||||
return gvar
|
||||
|
||||
def license_processing(tree, module):
|
||||
"""Process the LICENSE assignment in the given AST tree and return the section name"""
|
||||
count = 0
|
||||
for node in tree.body:
|
||||
if isinstance(node, ast.Assign):
|
||||
@ -27,7 +28,10 @@ def license_processing(tree, module):
|
||||
count += 1
|
||||
if isinstance(node.value, ast.Constant) and isinstance(node.value.value, str):
|
||||
emit_license(module, node.value.value)
|
||||
return "LICENSE"
|
||||
else:
|
||||
print("ERROR: LICENSE must be a string literal")
|
||||
return None
|
||||
else:
|
||||
print("ERROR: LICENSE already assigned")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user