| 1 |
name: env |
| 2 |
long_name: Environment |
| 3 |
description: | |
| 4 |
This object is returned by [[environment]] and stores |
| 5 |
detailed information about how environment variables should be set. |
| 6 |
It should be passed as the `env` keyword argument to tests and other functions. |
| 7 |
|
| 8 |
*Since 0.58.0* [[env.append]] and [[env.prepend]] can be called multiple times |
| 9 |
on the same `varname`. Earlier Meson versions would warn and only the last |
| 10 |
operation took effect. |
| 11 |
|
| 12 |
example: | |
| 13 |
```meson |
| 14 |
env = environment() |
| 15 |
|
| 16 |
# MY_PATH will be '0:1:2:3' |
| 17 |
env.set('MY_PATH', '1') |
| 18 |
env.append('MY_PATH', '2') |
| 19 |
env.append('MY_PATH', '3') |
| 20 |
env.prepend('MY_PATH', '0') |
| 21 |
``` |
| 22 |
|
| 23 |
methods: |
| 24 |
- name: append |
| 25 |
returns: void |
| 26 |
description: | |
| 27 |
appends the given values to |
| 28 |
the old value of the environment variable, e.g. `env.append('FOO', |
| 29 |
'BAR', 'BAZ', separator : ';')` produces `BOB;BAR;BAZ` if `FOO` had |
| 30 |
the value `BOB` and plain `BAR;BAZ` if the value was not defined. |
| 31 |
|
| 32 |
posargs: |
| 33 |
variable: |
| 34 |
type: str |
| 35 |
description: The variable to modify |
| 36 |
|
| 37 |
varargs: |
| 38 |
type: str |
| 39 |
name: Value |
| 40 |
description: The values to append |
| 41 |
|
| 42 |
kwargs: |
| 43 |
separator: |
| 44 |
type: str |
| 45 |
description: | |
| 46 |
The separator to use. If not explicitly specified, the default path |
| 47 |
separator for the host operating system will be used, i.e. ';' for |
| 48 |
Windows and ':' for UNIX/POSIX systems. |
| 49 |
|
| 50 |
- name: prepend |
| 51 |
returns: void |
| 52 |
description: Same as `append` except that it writes to the beginning of the variable. |
| 53 |
|
| 54 |
posargs: |
| 55 |
variable: |
| 56 |
type: str |
| 57 |
description: The variable to modify |
| 58 |
|
| 59 |
varargs: |
| 60 |
type: str |
| 61 |
name: Value |
| 62 |
description: The values to prepend |
| 63 |
|
| 64 |
kwargs_inherit: env.append |
| 65 |
|
| 66 |
- name: set |
| 67 |
returns: void |
| 68 |
description: | |
| 69 |
Sets the environment variable |
| 70 |
specified in the first argument to the values in the varargs |
| 71 |
joined by the separator. For instance, `env.set('FOO', 'BAR'),` sets envvar |
| 72 |
`FOO` to value `BAR`. |
| 73 |
|
| 74 |
posargs: |
| 75 |
variable: |
| 76 |
type: str |
| 77 |
description: The variable to modify |
| 78 |
|
| 79 |
varargs: |
| 80 |
type: str |
| 81 |
name: Value |
| 82 |
description: The values to set |
| 83 |
|
| 84 |
kwargs_inherit: env.append |
| 85 |
|
| 86 |
- name: unset |
| 87 |
returns: void |
| 88 |
since: 1.4.0 |
| 89 |
description: | |
| 90 |
Unset the specified environment variable. If this variable does not exist, |
| 91 |
nothing happens. |