feat(python): Add option to change the python binary (#1297)

* Add option to change the python binary

We are going to start to have problems with the python binary as python2
is removed and replaced with python3. To make the transition easier I
have added an option to the python module to allow the user to pick a
particular binary, e.g `python3`, for the module to use when selecting
the version of python. I have also refactored the python tests moving
almost all of them into the module and removing the dependency on the
version of python that is installed on the system.

* Add advanced config section to python module docs

Have added an advanced config section to the python module docs and
moved the `python_binary` option into that section.
This commit is contained in:
Thomas O'Donnell
2020-06-14 11:27:10 +02:00
committed by GitHub
parent b563d841c7
commit 055986e2b1
5 changed files with 187 additions and 204 deletions
+20 -1
View File
@@ -1225,6 +1225,25 @@ The module will be shown if any of the following conditions are met:
| `style` | `"bold yellow"` | The style for the module. |
| `disabled` | `false` | Disables the `python` module. |
<details>
<summary>This module has some advanced configuration options.</summary>
| Variable | Default | Description |
| --------------- | -------- | ---------------------------------------------------------------------------- |
| `python_binary` | `python` | Confgures the python binary that Starship executes when getting the version. |
The `python_binary` variable changes the binary that Starship executes to get
the version of Python, it doesn't change the arguments that are used.
```toml
# ~/.config/starship.toml
[python]
python_binary = "python3"
```
</details>
### Example
```toml
@@ -1480,7 +1499,7 @@ will simply show all custom modules in the order they were defined.
If unset, it will fallback to STARSHIP_SHELL and then to "sh" on Linux, and "cmd /C" on Windows.
If `shell` is not given or only contains one element and Starship detects PowerShell will be used,
the following arguments will automatically be added: `-NoProfile -Command -`.
the following arguments will automatically be added: `-NoProfile -Command -`.
This behavior can be avoided by explicitly passing arguments to the shell, e.g.
```toml