__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# SPDX-License-Identifier: Apache-2.0
# Copyright 2013-2024 Contributors to the The Meson project
import typing as T
import configparser
import os
from . import mparser
from .mesonlib import MesonException
if T.TYPE_CHECKING:
from .compilers import Compiler
from .coredata import StrOrBytesPath
CompilersDict = T.Dict[str, Compiler]
class CmdLineFileParser(configparser.ConfigParser):
def __init__(self) -> None:
# We don't want ':' as key delimiter, otherwise it would break when
# storing subproject options like "subproject:option=value"
super().__init__(delimiters=['='], interpolation=None)
def read(self, filenames: T.Union['StrOrBytesPath', T.Iterable['StrOrBytesPath']], encoding: T.Optional[str] = 'utf-8') -> T.List[str]:
return super().read(filenames, encoding)
def optionxform(self, optionstr: str) -> str:
# Don't call str.lower() on keys
return optionstr
class MachineFileParser():
def __init__(self, filenames: T.List[str], sourcedir: str) -> None:
self.parser = CmdLineFileParser()
self.constants: T.Dict[str, T.Union[str, bool, int, T.List[str]]] = {'True': True, 'False': False}
self.sections: T.Dict[str, T.Dict[str, T.Union[str, bool, int, T.List[str]]]] = {}
for fname in filenames:
try:
with open(fname, encoding='utf-8') as f:
content = f.read()
except UnicodeDecodeError as e:
raise MesonException(f'Malformed machine file {fname!r} failed to parse as unicode: {e}')
content = content.replace('@GLOBAL_SOURCE_ROOT@', sourcedir)
content = content.replace('@DIRNAME@', os.path.dirname(fname))
try:
self.parser.read_string(content, fname)
except configparser.Error as e:
raise MesonException(f'Malformed machine file: {e}')
# Parse [constants] first so they can be used in other sections
if self.parser.has_section('constants'):
self.constants.update(self._parse_section('constants'))
for s in self.parser.sections():
if s == 'constants':
continue
self.sections[s] = self._parse_section(s)
def _parse_section(self, s: str) -> T.Dict[str, T.Union[str, bool, int, T.List[str]]]:
self.scope = self.constants.copy()
section: T.Dict[str, T.Union[str, bool, int, T.List[str]]] = {}
for entry, value in self.parser.items(s):
if ' ' in entry or '\t' in entry or "'" in entry or '"' in entry:
raise MesonException(f'Malformed variable name {entry!r} in machine file.')
# Windows paths...
value = value.replace('\\', '\\\\')
try:
ast = mparser.Parser(value, 'machinefile').parse()
if not ast.lines:
raise MesonException('value cannot be empty')
res = self._evaluate_statement(ast.lines[0])
except MesonException as e:
raise MesonException(f'Malformed value in machine file variable {entry!r}: {str(e)}.')
except KeyError as e:
raise MesonException(f'Undefined constant {e.args[0]!r} in machine file variable {entry!r}.')
section[entry] = res
self.scope[entry] = res
return section
def _evaluate_statement(self, node: mparser.BaseNode) -> T.Union[str, bool, int, T.List[str]]:
if isinstance(node, (mparser.StringNode)):
return node.value
elif isinstance(node, mparser.BooleanNode):
return node.value
elif isinstance(node, mparser.NumberNode):
return node.value
elif isinstance(node, mparser.ParenthesizedNode):
return self._evaluate_statement(node.inner)
elif isinstance(node, mparser.ArrayNode):
# TODO: This is where recursive types would come in handy
return [self._evaluate_statement(arg) for arg in node.args.arguments]
elif isinstance(node, mparser.IdNode):
return self.scope[node.value]
elif isinstance(node, mparser.ArithmeticNode):
l = self._evaluate_statement(node.left)
r = self._evaluate_statement(node.right)
if node.operation == 'add':
if (isinstance(l, str) and isinstance(r, str)) or \
(isinstance(l, list) and isinstance(r, list)):
return l + r
elif node.operation == 'div':
if isinstance(l, str) and isinstance(r, str):
return os.path.join(l, r)
raise MesonException('Unsupported node type')
def parse_machine_files(filenames: T.List[str], sourcedir: str):
parser = MachineFileParser(filenames, sourcedir)
return parser.sections
class MachineFileStore:
def __init__(self, native_files, cross_files, source_dir):
self.native = MachineFileParser(native_files if native_files is not None else [], source_dir).sections
self.cross = MachineFileParser(cross_files if cross_files is not None else [], source_dir).sections
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| ast | Folder | 0755 |
|
|
| backend | Folder | 0755 |
|
|
| cargo | Folder | 0755 |
|
|
| cmake | Folder | 0755 |
|
|
| compilers | Folder | 0755 |
|
|
| dependencies | Folder | 0755 |
|
|
| interpreter | Folder | 0755 |
|
|
| interpreterbase | Folder | 0755 |
|
|
| linkers | Folder | 0755 |
|
|
| modules | Folder | 0755 |
|
|
| scripts | Folder | 0755 |
|
|
| templates | Folder | 0755 |
|
|
| utils | Folder | 0755 |
|
|
| wrap | Folder | 0755 |
|
|
| __init__.py | File | 0 B | 0644 |
|
| _pathlib.py | File | 1.87 KB | 0644 |
|
| _typing.py | File | 1.82 KB | 0644 |
|
| arglist.py | File | 12.39 KB | 0644 |
|
| build.py | File | 131.19 KB | 0644 |
|
| coredata.py | File | 39.85 KB | 0644 |
|
| depfile.py | File | 2.33 KB | 0644 |
|
| envconfig.py | File | 14.78 KB | 0644 |
|
| environment.py | File | 40.96 KB | 0644 |
|
| machinefile.py | File | 5.05 KB | 0644 |
|
| mcompile.py | File | 13.83 KB | 0644 |
|
| mconf.py | File | 16.87 KB | 0644 |
|
| mdevenv.py | File | 10.15 KB | 0644 |
|
| mdist.py | File | 15.86 KB | 0644 |
|
| mesondata.py | File | 1.23 KB | 0644 |
|
| mesonlib.py | File | 549 B | 0644 |
|
| mesonmain.py | File | 13.2 KB | 0644 |
|
| mformat.py | File | 36.15 KB | 0644 |
|
| minit.py | File | 8.07 KB | 0644 |
|
| minstall.py | File | 38.31 KB | 0644 |
|
| mintro.py | File | 29.83 KB | 0644 |
|
| mlog.py | File | 19.25 KB | 0644 |
|
| mparser.py | File | 39.99 KB | 0644 |
|
| msetup.py | File | 19 KB | 0644 |
|
| msubprojects.py | File | 32.47 KB | 0644 |
|
| mtest.py | File | 87.91 KB | 0644 |
|
| munstable_coredata.py | File | 4.14 KB | 0644 |
|
| optinterpreter.py | File | 11.43 KB | 0644 |
|
| options.py | File | 24.85 KB | 0644 |
|
| programs.py | File | 16.21 KB | 0644 |
|
| rewriter.py | File | 42.49 KB | 0644 |
|