diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2018-04-21 19:58:24 +0200 |
---|---|---|
committer | Mathieu Duponchelle <mathieu@centricular.com> | 2018-04-22 01:06:36 +0200 |
commit | 709e2bd70dbf9557fc6c408f36aa43029cf99e54 (patch) | |
tree | 917ee63474dbee4d088790513dd137234c165dea /docs/markdown | |
parent | 14db3861d832d30721ad43671b5a434e2f4abeb3 (diff) | |
download | meson-709e2bd70dbf9557fc6c408f36aa43029cf99e54.zip meson-709e2bd70dbf9557fc6c408f36aa43029cf99e54.tar.gz meson-709e2bd70dbf9557fc6c408f36aa43029cf99e54.tar.bz2 |
Python module: update documentation for new API
Diffstat (limited to 'docs/markdown')
-rw-r--r-- | docs/markdown/Python-module.md | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/docs/markdown/Python-module.md b/docs/markdown/Python-module.md index cad74c9..51721f0 100644 --- a/docs/markdown/Python-module.md +++ b/docs/markdown/Python-module.md @@ -142,7 +142,7 @@ This function expects no arguments or keyword arguments. #### `get_path()` ``` meson -string py_installation.get_path(path_name) +string py_installation.get_path(path_name, fallback) ``` Get a path as defined by the `sysconfig` module. @@ -153,15 +153,28 @@ For example: purelib = py_installation.get_path('purelib') ``` -This function accepts a single argument, `path_name`, which is expected to -be a non-empty string. +This function requires at least one argument, `path_name`, +which is expected to be a non-empty string. + +If `fallback` is specified, it will be returned if no path +with the given name exists. Otherwise, attempting to read +a non-existing path will cause a fatal error. **Returns**: A string +#### `has_path()` + +``` meson + bool py_installation.has_path(path_name) +``` + +**Returns**: true if a path named `path_name` can be retrieved with +[][`get_path()`], false otherwise. + #### `get_variable()` ``` meson -string py_installation.get_variable(variable_name) +string py_installation.get_variable(variable_name, fallback) ``` Get a variable as defined by the `sysconfig` module. @@ -169,14 +182,27 @@ Get a variable as defined by the `sysconfig` module. For example: ``` meson -py_bindir = py_installation.get_variable('BINDIR') +py_bindir = py_installation.get_variable('BINDIR', '') ``` -This function accepts a single argument, `variable_name`, which is expected to -be a non-empty string. +This function requires at least one argument, `variable_name`, +which is expected to be a non-empty string. + +If `fallback` is specified, it will be returned if no variable +with the given name exists. Otherwise, attempting to read +a non-existing variable will cause a fatal error. **Returns**: A string +#### `has_variable()` + +``` meson + bool py_installation.has_variable(variable_name) +``` + +**Returns**: true if a variable named `variable_name` can be retrieved with +[][`get_variable()`], false otherwise. + ## `python_dependency` object This [dependency object] subclass will try various methods to obtain the |