File: standard_funs.py

package info (click to toggle)
cmake-format 0.6.13-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,436 kB
  • sloc: python: 16,990; makefile: 14
file content (50 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Command specifications for cmake built-in commands.
"""

from __future__ import unicode_literals

from cmakelang.parse.funs import standard_builtins, standard_modules
from cmakelang.parse.util import CommandSpec

CANONICAL_SPELLINGS = {
    "FetchContent_Declare",
    "FetchContent_MakeAvailable",
    "FetchContent_GetProperties",
    "FetchContent_Populate",
    "ExternalProject_Add",
    "ExternalProject_Add_Step",
    "ExternalProject_Add_StepDependencies",
    "ExternalProject_Add_StepTargets",
    "ExternalProject_Get_Property",
}


def get_default_config():
  """
  Return the default per-command configuration database
  """
  per_command = {}
  for spelling in CANONICAL_SPELLINGS:
    per_command[spelling.lower()] = {
        "spelling": spelling
    }

  return per_command


def get_fn_spec():
  """
  Return a dictionary mapping cmake function names to a dictionary containing
  kwarg specifications.
  """

  fn_spec = CommandSpec('<root>')
  for grouping in (standard_builtins, standard_modules):
    for funname, spec in sorted(grouping.FUNSPECS.items()):
      fn_spec.add(funname, **spec)
  return fn_spec


# pylint: disable=bad-continuation
# pylint: disable=too-many-lines