OLD | NEW |
1 <!--- AUTOGENERATED BY `./recipes.py test train` --> | 1 <!--- AUTOGENERATED BY `./recipes.py test train` --> |
2 # Package documentation for [recipe\_engine](https://github.com/luci/recipes-py) | 2 # Package documentation for [recipe\_engine](https://github.com/luci/recipes-py) |
3 ## Table of Contents | 3 ## Table of Contents |
4 | 4 |
5 **[Recipe Modules](#recipe-modules)** | 5 **[Recipe Modules](#recipe-modules)** |
6 * [context](#recipe_modules--context) — The context module provides APIs
for manipulating a few pieces of 'ambient' data that affect how steps are run. | 6 * [context](#recipe_modules--context) — The context module provides APIs
for manipulating a few pieces of 'ambient' data that affect how steps are run. |
7 * [file](#recipe_modules--file) — File manipulation (read/write/delete/g
lob) methods. | 7 * [file](#recipe_modules--file) — File manipulation (read/write/delete/g
lob) methods. |
8 * [generator_script](#recipe_modules--generator_script) — A simplistic m
ethod for running steps generated by an external script. | 8 * [generator_script](#recipe_modules--generator_script) — A simplistic m
ethod for running steps generated by an external script. |
9 * [json](#recipe_modules--json) — Methods for producing and consuming JS
ON. | 9 * [json](#recipe_modules--json) — Methods for producing and consuming JS
ON. |
10 * [path](#recipe_modules--path) — All functions related to manipulating
paths in recipes. | 10 * [path](#recipe_modules--path) — All functions related to manipulating
paths in recipes. |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 * `api.path['checkout']` - This directory is set by various 'checkout' modules | 500 * `api.path['checkout']` - This directory is set by various 'checkout' modules |
501 in recipes. It was originally intended to make recipes easier to read and | 501 in recipes. It was originally intended to make recipes easier to read and |
502 make code somewhat generic or homogenous, but this was a mistake. New code | 502 make code somewhat generic or homogenous, but this was a mistake. New code |
503 should avoid 'checkout', and instead just explicitly pass paths around. This | 503 should avoid 'checkout', and instead just explicitly pass paths around. This |
504 path may be removed in the future. | 504 path may be removed in the future. |
505 | 505 |
506 There are other anchor points which can be defined (e.g. by the | 506 There are other anchor points which can be defined (e.g. by the |
507 `depot_tools/infra_paths` module). Refer to those modules for additional | 507 `depot_tools/infra_paths` module). Refer to those modules for additional |
508 documentation. | 508 documentation. |
509 | 509 |
510 #### **class [PathApi](/recipe_modules/path/api.py#L196)([RecipeApi](/recipe_eng
ine/recipe_api.py#L884)):** | 510 #### **class [PathApi](/recipe_modules/path/api.py#L197)([RecipeApi](/recipe_eng
ine/recipe_api.py#L884)):** |
511 | 511 |
512 — **def [\_\_getitem\_\_](/recipe_modules/path/api.py#L421)(self, name):** | 512 — **def [\_\_getitem\_\_](/recipe_modules/path/api.py#L422)(self, name):** |
513 | 513 |
514 Gets the base path named `name`. See module docstring for more | 514 Gets the base path named `name`. See module docstring for more |
515 information. | 515 information. |
516 | 516 |
517 — **def [abs\_to\_path](/recipe_modules/path/api.py#L351)(self, abs_string
_path):** | 517 — **def [abs\_to\_path](/recipe_modules/path/api.py#L352)(self, abs_string
_path):** |
518 | 518 |
519 Converts an absolute path string `string_path` to a real Path object, | 519 Converts an absolute path string `string_path` to a real Path object, |
520 using the most appropriate known base path. | 520 using the most appropriate known base path. |
521 | 521 |
522 * abs_string_path MUST be an absolute path | 522 * abs_string_path MUST be an absolute path |
523 * abs_string_path MUST be rooted in one of the configured base paths known | 523 * abs_string_path MUST be rooted in one of the configured base paths known |
524 to the path module. | 524 to the path module. |
525 | 525 |
526 This method will find the longest match in all the following: | 526 This method will find the longest match in all the following: |
527 * module resource paths | 527 * module resource paths |
528 * recipe resource paths | 528 * recipe resource paths |
529 * package repo paths | 529 * package repo paths |
530 * dynamic_paths | 530 * dynamic_paths |
531 * base_paths | 531 * base_paths |
532 | 532 |
533 Example: | 533 Example: |
534 ``` | 534 ``` |
535 # assume [START_DIR] == "/basis/dir/for/recipe" | 535 # assume [START_DIR] == "/basis/dir/for/recipe" |
536 api.path.abs_to_path("/basis/dir/for/recipe/some/other/dir") -> | 536 api.path.abs_to_path("/basis/dir/for/recipe/some/other/dir") -> |
537 Path("[START_DIR]/some/other/dir") | 537 Path("[START_DIR]/some/other/dir") |
538 ``` | 538 ``` |
539 | 539 |
540 Raises an ValueError if the preconditions are not met, otherwise returns the | 540 Raises an ValueError if the preconditions are not met, otherwise returns the |
541 Path object. | 541 Path object. |
542 | 542 |
543 — **def [assert\_absolute](/recipe_modules/path/api.py#L326)(self, path):*
* | 543 — **def [assert\_absolute](/recipe_modules/path/api.py#L327)(self, path):*
* |
544 | 544 |
545 Raises AssertionError if the given path is not an absolute path. | 545 Raises AssertionError if the given path is not an absolute path. |
546 | 546 |
547 Args: | 547 Args: |
548 * path (Path|str) - The path to check. | 548 * path (Path|str) - The path to check. |
549 | 549 |
550 — **def [get](/recipe_modules/path/api.py#L414)(self, name, default=None):
** | 550 — **def [get](/recipe_modules/path/api.py#L415)(self, name, default=None):
** |
551 | 551 |
552 Gets the base path named `name`. See module docstring for more | 552 Gets the base path named `name`. See module docstring for more |
553 information. | 553 information. |
554 | 554 |
555 — **def [get\_config\_defaults](/recipe_modules/path/api.py#L208)(self):** | 555 — **def [get\_config\_defaults](/recipe_modules/path/api.py#L209)(self):** |
556 | 556 |
557 Internal recipe implementation function. | 557 Internal recipe implementation function. |
558 | 558 |
559 — **def [initialize](/recipe_modules/path/api.py#L270)(self):** | 559 — **def [initialize](/recipe_modules/path/api.py#L271)(self):** |
560 | 560 |
561 Internal recipe implementation function. | 561 Internal recipe implementation function. |
562 | 562 |
563 — **def [mkdtemp](/recipe_modules/path/api.py#L334)(self, prefix):** | 563 — **def [mkdtemp](/recipe_modules/path/api.py#L335)(self, prefix):** |
564 | 564 |
565 Makes a new temporary directory, returns Path to it. | 565 Makes a new temporary directory, returns Path to it. |
566 | 566 |
567 — **def [mock\_add\_paths](/recipe_modules/path/api.py#L305)(self, path):*
* | 567 — **def [mock\_add\_paths](/recipe_modules/path/api.py#L306)(self, path):*
* |
568 | 568 |
569 For testing purposes, mark that |path| exists. | 569 For testing purposes, mark that |path| exists. |
570 | 570 |
571 — **def [mock\_copy\_paths](/recipe_modules/path/api.py#L310)(self, source
, dest):** | 571 — **def [mock\_copy\_paths](/recipe_modules/path/api.py#L311)(self, source
, dest):** |
572 | 572 |
573 For testing purposes, copy |source| to |dest|. | 573 For testing purposes, copy |source| to |dest|. |
574 | 574 |
575 — **def [mock\_remove\_paths](/recipe_modules/path/api.py#L315)(self, path
, filt=(lambda p: True)):** | 575 — **def [mock\_remove\_paths](/recipe_modules/path/api.py#L316)(self, path
, filt=(lambda p: True)):** |
576 | 576 |
577 For testing purposes, assert that |path| doesn't exist. | 577 For testing purposes, assert that |path| doesn't exist. |
578 | 578 |
579 Args: | 579 Args: |
580 * path (str|Path) - The path to remove. | 580 * path (str|Path) - The path to remove. |
581 * filt (func[str] bool) - Called for every candidate path. Return | 581 * filt (func[str] bool) - Called for every candidate path. Return |
582 True to remove this path. | 582 True to remove this path. |
583 ### *recipe_modules* / [platform](/recipe_modules/platform) | 583 ### *recipe_modules* / [platform](/recipe_modules/platform) |
584 | 584 |
585 Mockable system platform identity functions. | 585 Mockable system platform identity functions. |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 | 1327 |
1328 [DEPS](/recipe_modules/url/tests/join.py#L5): [step](#recipe_modules--step), [ur
l](#recipe_modules--url) | 1328 [DEPS](/recipe_modules/url/tests/join.py#L5): [step](#recipe_modules--step), [ur
l](#recipe_modules--url) |
1329 | 1329 |
1330 — **def [RunSteps](/recipe_modules/url/tests/join.py#L11)(api):** | 1330 — **def [RunSteps](/recipe_modules/url/tests/join.py#L11)(api):** |
1331 ### *recipes* / [url:tests/validate\_url](/recipe_modules/url/tests/validate_url
.py) | 1331 ### *recipes* / [url:tests/validate\_url](/recipe_modules/url/tests/validate_url
.py) |
1332 | 1332 |
1333 [DEPS](/recipe_modules/url/tests/validate_url.py#L5): [properties](#recipe_modul
es--properties), [step](#recipe_modules--step), [url](#recipe_modules--url) | 1333 [DEPS](/recipe_modules/url/tests/validate_url.py#L5): [properties](#recipe_modul
es--properties), [step](#recipe_modules--step), [url](#recipe_modules--url) |
1334 | 1334 |
1335 — **def [RunSteps](/recipe_modules/url/tests/validate_url.py#L12)(api):** | 1335 — **def [RunSteps](/recipe_modules/url/tests/validate_url.py#L12)(api):** |
1336 | 1336 |
OLD | NEW |