Support multiple python versions for code generation
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from pathlib import Path
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List, Dict
|
||||
from codegen.constants import WAPP_SRC_ROOT
|
||||
from codegen.utils import load_func_body_from_file
|
||||
from codegen.utils import load_func_body_from_file, convert_to_relative
|
||||
from codegen.datatypes import (
|
||||
CDataType,
|
||||
CMacro,
|
||||
@@ -23,11 +24,11 @@ from codegen.datatypes import (
|
||||
class DblListData:
|
||||
node_typename: str
|
||||
list_typename: str
|
||||
hdr_decl_types: list[CStruct] = field(default_factory=list)
|
||||
src_decl_types: list[CStruct] = field(default_factory=list)
|
||||
hdr_decl_types: List[CStruct] = field(default_factory=list)
|
||||
src_decl_types: List[CStruct] = field(default_factory=list)
|
||||
|
||||
|
||||
def make_dbl_list(user_datatypes: dict[CDataType, DblListData] = {}):
|
||||
def make_dbl_list(user_datatypes: Dict[CDataType, DblListData] = {}):
|
||||
def __format_func_body(
|
||||
filename: Path,
|
||||
type_string: str,
|
||||
@@ -50,18 +51,18 @@ def make_dbl_list(user_datatypes: dict[CDataType, DblListData] = {}):
|
||||
common_local_include_files = [
|
||||
(WAPP_SRC_ROOT / "common" / "aliases" / "aliases.h")
|
||||
]
|
||||
common_includes: list[CInclude] = [
|
||||
common_includes: List[CInclude] = [
|
||||
CInclude(header="stdbool.h")
|
||||
]
|
||||
for local_file in common_local_include_files:
|
||||
common_includes.append(
|
||||
CInclude(
|
||||
header=str(local_file.relative_to(out_dir, walk_up=True)),
|
||||
header=str(convert_to_relative(local_file, out_dir)),
|
||||
local=True,
|
||||
)
|
||||
)
|
||||
|
||||
common_decl_types: list[CStruct] = []
|
||||
common_decl_types: List[CStruct] = []
|
||||
|
||||
datatypes: dict[CDataType, DblListData] = {
|
||||
"Str8": DblListData(
|
||||
|
Reference in New Issue
Block a user