github.phpd.cn/thought-machine/please@v12.2.0+incompatible/src/parse/rules/builtins.build_defs (about) 1 # Contains declarations of built-in functions & objects 2 3 4 # Do not change the order of arguments to this function unless you feel like 5 # updating all of targets.go to match it. 6 def build_rule(name:str, cmd:str|dict='', test_cmd:str|dict='', srcs:list|dict=None, data:list=None, outs:list|dict=None, 7 deps:list=None, exported_deps:list=None, secrets:list=None, tools:list|dict=None, labels:list=None, 8 visibility:list=CONFIG.DEFAULT_VISIBILITY, hashes:list=None, binary:bool=False, test:bool=False, 9 test_only:bool=CONFIG.DEFAULT_TESTONLY, building_description:str=None, needs_transitive_deps:bool=False, 10 output_is_complete:bool=False, container:bool|dict=False, sandbox:bool=CONFIG.BUILD_SANDBOX, 11 test_sandbox:bool=CONFIG.TEST_SANDBOX, no_test_output:bool=False, flaky:bool|int=0, build_timeout:int=0, 12 test_timeout:int=0, pre_build:function=None, post_build:function=None, requires:list=None, provides:dict=None, 13 licences:list=CONFIG.DEFAULT_LICENCES, test_outputs:list=None, system_srcs:list=None, stamp:bool=False, 14 tag:str='', optional_outs:list=None, progress:bool=False, _urls:list=None): 15 pass 16 17 18 def len(obj): 19 pass 20 def enumerate(seq:list): 21 pass 22 def zip(args): 23 pass 24 25 def join(self, seq:list): 26 pass 27 def split(self, on:str=' '): 28 pass 29 def replace(self, old:str, new:str): 30 pass 31 def partition(self, sep:str): 32 pass 33 def rpartition(self, sep:str): 34 pass 35 def startswith(self, s:str): 36 pass 37 def endswith(self, s:str): 38 pass 39 def format(self): 40 pass 41 def lstrip(self, cutset:str=' \n'): 42 pass 43 def rstrip(self, cutset:str=' \n'): 44 pass 45 def strip(self, cutset:str=' \n'): 46 pass 47 def find(self, needle:str): 48 pass 49 def rfind(self, needle:str): 50 pass 51 def count(self, needle:str): 52 pass 53 def upper(self): 54 pass 55 def lower(self): 56 pass 57 58 def fail(msg:str): 59 pass 60 61 def subinclude(target:str, hash:str=None): 62 pass 63 def load(target:str, names:str=None): 64 pass 65 def subrepo(name:str, dep:str='', path:str=None): 66 pass 67 68 69 def isinstance(obj, types:function|list): 70 pass 71 72 73 def range(start:int, stop:int=None, step:int=1): 74 pass 75 def any(seq:list): 76 for x in seq: 77 if x: 78 return True 79 return False 80 def all(seq:list): 81 for x in seq: 82 if not x: 83 return False 84 return True 85 86 87 def bool(b): 88 pass 89 def int(s:str): 90 pass 91 def str(s): 92 pass 93 def list(l): 94 raise 'list is not callable' 95 def dict(d): 96 raise 'dict is not callable' 97 98 99 def glob(include:list, exclude:list&excludes=[], hidden:bool=False): 100 pass 101 102 103 def package(): 104 pass 105 106 107 def sorted(seq:list): 108 pass 109 110 111 def get(self, key:str, default=None): 112 pass 113 def setdefault(self, key:str, default=None): 114 if key in self: 115 return self[key] 116 self[key] = default 117 return default 118 def config_get(self, key:str, default=None): 119 pass 120 121 122 def get_base_path(): 123 pass 124 def package_name(): 125 pass 126 127 128 def keys(self): 129 pass 130 def values(self): 131 pass 132 def items(self): 133 pass 134 def copy(self): 135 pass 136 137 138 def debug(args): 139 pass 140 def info(args): 141 pass 142 def notice(args): 143 pass 144 def warning(args): 145 pass 146 def error(args): 147 pass 148 def fatal(args): 149 pass 150 151 log = { 152 'debug': debug, 153 'info': info, 154 'notice': notice, 155 'warning': warning, 156 'error': error, 157 'fatal': fatal, 158 } 159 160 161 def join_path(paths:str): 162 pass # Has to be implemented natively since it's varargs. 163 164 165 def split_path(p:str): 166 before, _, after = p.rpartition('/') 167 return before, after 168 169 170 def splitext(p:str): 171 before, dot, after = p.rpartition('.') 172 return (before, dot + after) if before else (after, '') 173 174 175 def basename(p:str): 176 """Returns the final component of a pathname""" 177 _, _, after = p.rpartition('/') 178 return after 179 180 181 def dirname(p:str): 182 """Returns the directory component of a pathname""" 183 before, _, after = p.rpartition('/') 184 return before 185 186 187 # Exception types. 188 # There is no actual Exception, but str() is similar enough here. 189 ParseError = str 190 ConfigError = str 191 ValueError = str 192 193 194 # Post-build callback functions. 195 def get_labels(name:str, prefix:str): 196 pass 197 def has_label(name:str, prefix:str): 198 return len(get_labels(name, prefix)) > 0 199 def add_dep(target:str, dep:str, exported:bool=False): 200 pass 201 def add_exported_dep(target:str, dep:str): 202 add_dep(target, dep, True) 203 def add_out(target:str, name:str, out:str=''): 204 pass 205 def add_licence(target:str, licence:str): 206 pass 207 def get_command(target:str, config:str=''): 208 pass 209 def set_command(target:str, config:str, command:str=''): 210 pass