Configuration
This page documents west’s configuration file system, the west config
command, and configuration options used by built-in commands. For API
documentation on the west.configuration
module, see
west.configuration.
West Configuration Files
West’s configuration file syntax is INI-like; here is an example file:
[manifest]
path = zephyr
[zephyr]
base = zephyr
Above, the manifest
section has option path
set to zephyr
. Another
way to say the same thing is that manifest.path
is zephyr
in this file.
There are three types of configuration file:
System: Settings in this file affect west’s behavior for every user logged in to the computer. Its location depends on the platform:
Linux:
/etc/westconfig
macOS:
/usr/local/etc/westconfig
Windows:
%PROGRAMDATA%\west\config
Global (per user): Settings in this file affect how west behaves when run by a particular user on the computer.
All platforms: the default is
.westconfig
in the user’s home directory.Linux note: if the environment variable
XDG_CONFIG_HOME
is set, then$XDG_CONFIG_HOME/west/config
is used.Windows note: the following environment variables are tested to find the home directory:
%HOME%
, then%USERPROFILE%
, then a combination of%HOMEDRIVE%
and%HOMEPATH%
.
Local: Settings in this file affect west’s behavior for the current west workspace. The file is
.west/config
, relative to the workspace’s root directory.
A setting in a file which appears lower down on this list overrides an earlier
setting. For example, if color.ui
is true
in the system’s configuration
file, but false
in the workspace’s, then the final value is
false
. Similarly, settings in the user configuration file override system
settings, and so on.
west config
The built-in config
command can be used to get and set configuration
values. You can pass west config
the options --system
, --global
, or
--local
to specify which configuration file to use. Only one of these can
be used at a time. If none is given, then writes default to --local
, and
reads show the final value after applying overrides.
Some examples for common uses follow; run west config -h
for detailed help,
and see Built-in Configuration Options for more details on built-in options.
To set manifest.path
to some-other-manifest
:
west config manifest.path some-other-manifest
Doing the above means that commands like west update
will look for the
west manifest inside the some-other-manifest
directory
(relative to the workspace root directory) instead of the directory given to
west init
, so be careful!
To read zephyr.base
, the value which will be used as ZEPHYR_BASE
if it
is unset in the calling environment (also relative to the workspace root):
west config zephyr.base
You can switch to another zephyr repository without changing manifest.path
– and thus the behavior of commands like west update
– using:
west config zephyr.base some-other-zephyr
This can be useful if you use commands like git worktree
to create your own
zephyr directories, and want commands like west build
to use them instead
of the zephyr repository specified in the manifest. (You can go back to using
the directory in the upstream manifest by running west config zephyr.base
zephyr
.)
To set color.ui
to false
in the global (user-wide) configuration file,
so that west will no longer print colored output for that user when run in any
workspace:
west config --global color.ui false
To undo the above change:
west config --global color.ui true
Built-in Configuration Options
The following table documents configuration options supported by west’s built-in commands. Configuration options supported by Zephyr’s extension commands are documented in the pages for those commands.
Option |
Description |
---|---|
|
String. If non-empty the |
|
Boolean. If |
|
Boolean, default |
|
String, default empty. Set this to |
|
String, one of |
|
String, default empty. The |
|
String, default empty. The |
|
String, default |
|
String, default empty. A comma-separated list of project groups to
enable and disable within the workspace. Prefix enabled groups with
|
|
String, relative path from the west workspace root directory
to the manifest repository used by |
|
Comma-separated list of strings. The option’s value is a comma-separated list of regular expressions,
each prefixed with +re1,-re2,-re3
Project names are matched against each regular expression ( If a project’s name matches multiple regular expressions in the list,
the result from the last regular expression is used. For example,
if -hal_.*,+hal_foo
Then a project named If a project is made inactive or active by a list element, the project is active or not regardless of whether any or all of its groups are disabled. (This is currently the only way to make a project that has no groups inactive.) Otherwise, i.e. if a project does not match any regular expressions in the list, it is active or inactive according to the usual rules related to its groups (see Project Group Examples for examples in that case). Within an element of a +foo,-bar
+foo , -bar
Any empty elements are ignored. That means these example values are equivalent: +foo,,-bar
+foo,-bar
|
|
String, one of |
|
String. If non-empty, |
|
Boolean. If |
|
String. If non-empty, |
|
Boolean. If |
|
String, default value to set for the |
|
String, one the values |