|
|
|
@ -28,7 +28,7 @@ from .ast import IntrospectionInterpreter, BUILD_TARGET_FUNCTIONS, AstConditionL |
|
|
|
|
from mesonbuild.mesonlib import MesonException, setup_vsenv |
|
|
|
|
from . import mlog, environment |
|
|
|
|
from functools import wraps |
|
|
|
|
from .mparser import Token, ArrayNode, ArgumentNode, AssignmentNode, BooleanNode, ElementaryNode, IdNode, FunctionNode, StringNode |
|
|
|
|
from .mparser import Token, ArrayNode, ArgumentNode, AssignmentNode, BaseStringNode, BooleanNode, ElementaryNode, IdNode, FunctionNode, StringNode |
|
|
|
|
import json, os, re, sys |
|
|
|
|
import typing as T |
|
|
|
|
|
|
|
|
@ -267,12 +267,12 @@ class MTypeStrList(MTypeList): |
|
|
|
|
return StringNode(Token('', '', 0, 0, 0, None, str(value))) |
|
|
|
|
|
|
|
|
|
def _check_is_equal(self, node, value) -> bool: |
|
|
|
|
if isinstance(node, StringNode): |
|
|
|
|
if isinstance(node, BaseStringNode): |
|
|
|
|
return node.value == value |
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
def _check_regex_matches(self, node, regex: str) -> bool: |
|
|
|
|
if isinstance(node, StringNode): |
|
|
|
|
if isinstance(node, BaseStringNode): |
|
|
|
|
return re.match(regex, node.value) is not None |
|
|
|
|
return False |
|
|
|
|
|
|
|
|
@ -292,7 +292,7 @@ class MTypeIDList(MTypeList): |
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
def _check_regex_matches(self, node, regex: str) -> bool: |
|
|
|
|
if isinstance(node, StringNode): |
|
|
|
|
if isinstance(node, BaseStringNode): |
|
|
|
|
return re.match(regex, node.value) is not None |
|
|
|
|
return False |
|
|
|
|
|
|
|
|
@ -652,7 +652,7 @@ class Rewriter: |
|
|
|
|
src_list = [] |
|
|
|
|
for i in target['sources']: |
|
|
|
|
for j in arg_list_from_node(i): |
|
|
|
|
if isinstance(j, StringNode): |
|
|
|
|
if isinstance(j, BaseStringNode): |
|
|
|
|
src_list += [j.value] |
|
|
|
|
|
|
|
|
|
# Generate the new String nodes |
|
|
|
@ -686,7 +686,7 @@ class Rewriter: |
|
|
|
|
def find_node(src): |
|
|
|
|
for i in target['sources']: |
|
|
|
|
for j in arg_list_from_node(i): |
|
|
|
|
if isinstance(j, StringNode): |
|
|
|
|
if isinstance(j, BaseStringNode): |
|
|
|
|
if j.value == src: |
|
|
|
|
return i, j |
|
|
|
|
return None, None |
|
|
|
@ -745,7 +745,7 @@ class Rewriter: |
|
|
|
|
extra_files_list = [] |
|
|
|
|
for i in target['extra_files']: |
|
|
|
|
for j in arg_list_from_node(i): |
|
|
|
|
if isinstance(j, StringNode): |
|
|
|
|
if isinstance(j, BaseStringNode): |
|
|
|
|
extra_files_list += [j.value] |
|
|
|
|
|
|
|
|
|
# Generate the new String nodes |
|
|
|
@ -776,7 +776,7 @@ class Rewriter: |
|
|
|
|
def find_node(src): |
|
|
|
|
for i in target['extra_files']: |
|
|
|
|
for j in arg_list_from_node(i): |
|
|
|
|
if isinstance(j, StringNode): |
|
|
|
|
if isinstance(j, BaseStringNode): |
|
|
|
|
if j.value == src: |
|
|
|
|
return i, j |
|
|
|
|
return None, None |
|
|
|
@ -845,12 +845,12 @@ class Rewriter: |
|
|
|
|
src_list = [] |
|
|
|
|
for i in target['sources']: |
|
|
|
|
for j in arg_list_from_node(i): |
|
|
|
|
if isinstance(j, StringNode): |
|
|
|
|
if isinstance(j, BaseStringNode): |
|
|
|
|
src_list += [j.value] |
|
|
|
|
extra_files_list = [] |
|
|
|
|
for i in target['extra_files']: |
|
|
|
|
for j in arg_list_from_node(i): |
|
|
|
|
if isinstance(j, StringNode): |
|
|
|
|
if isinstance(j, BaseStringNode): |
|
|
|
|
extra_files_list += [j.value] |
|
|
|
|
test_data = { |
|
|
|
|
'name': target['name'], |
|
|
|
@ -865,8 +865,8 @@ class Rewriter: |
|
|
|
|
alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)] |
|
|
|
|
path_sorter = lambda key: ([(key.count('/') <= idx, alphanum_key(x)) for idx, x in enumerate(key.split('/'))]) |
|
|
|
|
|
|
|
|
|
unknown = [x for x in i.arguments if not isinstance(x, StringNode)] |
|
|
|
|
sources = [x for x in i.arguments if isinstance(x, StringNode)] |
|
|
|
|
unknown = [x for x in i.arguments if not isinstance(x, BaseStringNode)] |
|
|
|
|
sources = [x for x in i.arguments if isinstance(x, BaseStringNode)] |
|
|
|
|
sources = sorted(sources, key=lambda x: path_sorter(x.value)) |
|
|
|
|
i.arguments = unknown + sources |
|
|
|
|
|
|
|
|
|