Skip to content

Commit 22fb40c

Browse files
authored
[poetry plugin] ensure initHook runs with /bin/sh (#1553)
## Summary A user is saying that the poetry plugin's init-hook was failing for them with Fish shell. While the init-hook's command does work with modern fish shells, it fails for older versions of fish. In this case, the user is on Ubuntu whose package manager seems to use an older version of fish. Regardless, we can ensure the plugin's init-hooks work for consistently if we ensure that they are written as posix scripts executed via /bin/sh. This PR seeks to do that. Fixes #1550 ## How was it tested? ``` cd examples/development/poetry/poetry_demo devbox run run_test ```
1 parent 4380b7c commit 22fb40c

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

examples/development/python/poetry/poetry-demo/devbox.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"packages": {
44
55
"last_modified": "2023-05-19T19:44:39Z",
6-
"plugin_version": "0.0.1",
6+
"plugin_version": "0.0.2",
77
"resolved": "github:NixOS/nixpkgs/4a22f6f0a4b4354778f786425babce9a56f6b5d8#poetry",
88
"source": "devbox-search",
99
"version": "1.4.2",

internal/impl/devbox.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,6 @@ func (d *Devbox) computeNixEnv(ctx context.Context, usePrintDevEnvCache bool) (m
766766
// Append variables from current env if --pure is not passed
767767
currentEnv := os.Environ()
768768
env, err := d.parseEnvAndExcludeSpecialCases(currentEnv)
769-
770769
if err != nil {
771770
return nil, err
772771
}

plugins/poetry.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
{
22
"name": "poetry",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"readme": "This plugin automatically configures poetry to use the version of python installed in your Devbox shell, instead of the Python version that it is bundled with. Your pyproject.toml must be in the same directory as your devbox.json.",
55
"env": {
66
"POETRY_VIRTUALENVS_IN_PROJECT": "true",
77
"POETRY_VIRTUALENVS_CREATE": "true",
88
"POETRY_VIRTUALENVS_PATH": "{{.Virtenv}}/.virtualenvs"
99
},
10+
"create_files": {
11+
"{{ .Virtenv }}/bin/initHook.sh": "poetry/initHook.sh"
12+
},
1013
"shell": {
1114
"init_hook": [
12-
"poetry env use $(command -v python) --no-interaction"
15+
"{{ .Virtenv }}/bin/initHook.sh"
1316
]
1417
}
1518
}

plugins/poetry/initHook.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
poetry env use $(command -v python) --no-interaction
4+

0 commit comments

Comments
 (0)