From e558935e7c32498a864b93d91cbef226f7ed4e5e Mon Sep 17 00:00:00 2001 From: Savil Srivastava <676452+savil@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:36:13 -0700 Subject: [PATCH 1/2] [poetry plugin] ensure initHook runs with /bin/sh --- examples/development/python/poetry/poetry-demo/devbox.lock | 2 +- plugins/poetry.json | 7 +++++-- plugins/poetry/initHook.sh | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 plugins/poetry/initHook.sh diff --git a/examples/development/python/poetry/poetry-demo/devbox.lock b/examples/development/python/poetry/poetry-demo/devbox.lock index 04d0d6516ae..89c8b1442ed 100644 --- a/examples/development/python/poetry/poetry-demo/devbox.lock +++ b/examples/development/python/poetry/poetry-demo/devbox.lock @@ -3,7 +3,7 @@ "packages": { "poetry@1.4": { "last_modified": "2023-05-19T19:44:39Z", - "plugin_version": "0.0.1", + "plugin_version": "0.0.2", "resolved": "github:NixOS/nixpkgs/4a22f6f0a4b4354778f786425babce9a56f6b5d8#poetry", "source": "devbox-search", "version": "1.4.2", diff --git a/plugins/poetry.json b/plugins/poetry.json index 5ee9833d987..c45784c6e6b 100644 --- a/plugins/poetry.json +++ b/plugins/poetry.json @@ -1,15 +1,18 @@ { "name": "poetry", - "version": "0.0.2", + "version": "0.0.3", "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.", "env": { "POETRY_VIRTUALENVS_IN_PROJECT": "true", "POETRY_VIRTUALENVS_CREATE": "true", "POETRY_VIRTUALENVS_PATH": "{{.Virtenv}}/.virtualenvs" }, + "create_files": { + "{{ .Virtenv }}/bin/initHook.sh": "poetry/initHook.sh" + }, "shell": { "init_hook": [ - "poetry env use $(command -v python) --no-interaction" + "{{ .Virtenv }}/bin/initHook.sh" ] } } diff --git a/plugins/poetry/initHook.sh b/plugins/poetry/initHook.sh new file mode 100644 index 00000000000..b01c5be40f2 --- /dev/null +++ b/plugins/poetry/initHook.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +poetry env use $(command -v python) --no-interaction + From 680a7bee41de59b7c486729573db4d2296d53af6 Mon Sep 17 00:00:00 2001 From: Savil Srivastava <676452+savil@users.noreply.github.com> Date: Thu, 12 Oct 2023 05:26:04 -0700 Subject: [PATCH 2/2] fix lint --- internal/impl/devbox.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/impl/devbox.go b/internal/impl/devbox.go index 16e99f198c7..952b59be5e7 100644 --- a/internal/impl/devbox.go +++ b/internal/impl/devbox.go @@ -766,7 +766,6 @@ func (d *Devbox) computeNixEnv(ctx context.Context, usePrintDevEnvCache bool) (m // Append variables from current env if --pure is not passed currentEnv := os.Environ() env, err := d.parseEnvAndExcludeSpecialCases(currentEnv) - if err != nil { return nil, err }