simplify instantiation of builtin type using builtins instead of functions

This commit is contained in:
Eli Schwartz 2022-10-30 13:08:47 -04:00
parent a21af43200
commit c9ac73a4da
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
6 changed files with 47 additions and 17 deletions

View File

@ -2143,7 +2143,7 @@ class NinjaBackend(backends.Backend):
rsp_file_syntax() is only guaranteed to be implemented if
can_linker_accept_rsp() returns True.
"""
options = dict(rspable=tool.can_linker_accept_rsp())
options = {'rspable': tool.can_linker_accept_rsp()}
if options['rspable']:
options['rspfile_quote_style'] = tool.rsp_file_syntax()
return options

View File

@ -336,8 +336,8 @@ class CudaModule(NewExtensionModule):
arch_ptx = arch_bin
cuda_arch_ptx += arch_ptx
cuda_arch_bin = sorted(list(set(cuda_arch_bin)))
cuda_arch_ptx = sorted(list(set(cuda_arch_ptx)))
cuda_arch_bin = sorted(set(cuda_arch_bin))
cuda_arch_ptx = sorted(set(cuda_arch_ptx))
nvcc_flags = []
nvcc_archs_readable = []

View File

@ -104,7 +104,7 @@ def run(options):
print(' version: ' + repr(dep.get_version()))
for for_machine in iter(MachineChoice):
items_list = list(sorted(v[for_machine].items()))
items_list = sorted(v[for_machine].items())
if items_list:
print(f'Cached dependencies for {for_machine.get_lower_case_name()} machine')
for dep_key, deps in items_list:

View File

@ -884,7 +884,7 @@ class Rewriter:
# Sort based on line and column in reversed order
work_nodes = [{'node': x, 'action': 'modify'} for x in self.modified_nodes]
work_nodes += [{'node': x, 'action': 'rm'} for x in self.to_remove_nodes]
work_nodes = list(sorted(work_nodes, key=lambda x: (x['node'].lineno, x['node'].colno), reverse=True))
work_nodes = sorted(work_nodes, key=lambda x: (x['node'].lineno, x['node'].colno), reverse=True)
work_nodes += [{'node': x, 'action': 'add'} for x in self.to_add_nodes]
# Generating the new replacement string

View File

@ -131,16 +131,18 @@ def get_args_from_envvars(infos: MachineInfo) -> None:
if objcpp_link_args:
infos.link_args['objcpp'] = objcpp_link_args
cpu_family_map = dict(mips64el="mips64",
i686='x86')
cpu_map = dict(armhf="arm7hlf",
mips64el="mips64",
powerpc64le="ppc64",
)
cpu_family_map = {
'mips64el': 'mips64',
'i686': 'x86',
}
cpu_map = {
'armhf': 'arm7hlf',
'mips64el': 'mips64'
}
def deb_detect_cmake(infos: MachineInfo, data: T.Dict[str, str]) -> None:
system_name_map = dict(linux="Linux", kfreebsd="kFreeBSD", hurd="GNU")
system_processor_map = dict(arm='armv7l', mips64el='mips64', powerpc64le='ppc64le')
system_name_map = {'linux': 'Linux', 'kfreebsd': 'kFreeBSD', 'hurd': 'GNU'}
system_processor_map = {'arm': 'armv7l', 'mips64el': 'mips64', 'powerpc64le': 'ppc64le'}
infos.cmake["CMAKE_C_COMPILER"] = infos.compilers['c']
infos.cmake["CMAKE_CXX_COMPILER"] = infos.compilers['cpp']

View File

@ -736,10 +736,38 @@ def windows_detect_native_arch() -> str:
def detect_vcs(source_dir: T.Union[str, Path]) -> T.Optional[T.Dict[str, str]]:
vcs_systems = [
dict(name = 'git', cmd = 'git', repo_dir = '.git', get_rev = 'git describe --dirty=+', rev_regex = '(.*)', dep = '.git/logs/HEAD'),
dict(name = 'mercurial', cmd = 'hg', repo_dir = '.hg', get_rev = 'hg id -i', rev_regex = '(.*)', dep = '.hg/dirstate'),
dict(name = 'subversion', cmd = 'svn', repo_dir = '.svn', get_rev = 'svn info', rev_regex = 'Revision: (.*)', dep = '.svn/wc.db'),
dict(name = 'bazaar', cmd = 'bzr', repo_dir = '.bzr', get_rev = 'bzr revno', rev_regex = '(.*)', dep = '.bzr'),
{
'name': 'git',
'cmd': 'git',
'repo_dir': '.git',
'get_rev': 'git describe --dirty=+',
'rev_regex': '(.*)',
'dep': '.git/logs/HEAD'
},
{
'name': 'mercurial',
'cmd': 'hg',
'repo_dir': '.hg',
'get_rev': 'hg id -i',
'rev_regex': '(.*)',
'dep': '.hg/dirstate'
},
{
'name': 'subversion',
'cmd': 'svn',
'repo_dir': '.svn',
'get_rev': 'svn info',
'rev_regex': 'Revision: (.*)',
'dep': '.svn/wc.db'
},
{
'name': 'bazaar',
'cmd': 'bzr',
'repo_dir': '.bzr',
'get_rev': 'bzr revno',
'rev_regex': '(.*)',
'dep': '.bzr'
},
]
if isinstance(source_dir, str):
source_dir = Path(source_dir)