From 975413e79308f353dfa0f7e64ac76f6cfdc857e3 Mon Sep 17 00:00:00 2001 From: Adam Smith Date: Sun, 10 Apr 2022 16:32:31 -0700 Subject: [PATCH] universe: python: allow custom path to python Closes #2114 Signed-off-by: Adam Smith --- pkg/universe.dagger.io/python/python.cue | 2 +- pkg/universe.dagger.io/python/test/test.cue | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pkg/universe.dagger.io/python/python.cue b/pkg/universe.dagger.io/python/python.cue index 100adfb2..308ecc4b 100644 --- a/pkg/universe.dagger.io/python/python.cue +++ b/pkg/universe.dagger.io/python/python.cue @@ -42,7 +42,7 @@ import ( docker.#Run & { command: { - name: "python3" + name: string | *"python3" "args": ["\(_mountpoint)/\(script._filename)"] + args } diff --git a/pkg/universe.dagger.io/python/test/test.cue b/pkg/universe.dagger.io/python/test/test.cue index 2aa0ca3c..ef4d9dc4 100644 --- a/pkg/universe.dagger.io/python/test/test.cue +++ b/pkg/universe.dagger.io/python/test/test.cue @@ -3,13 +3,28 @@ package python import ( "dagger.io/dagger" "dagger.io/dagger/core" - + "universe.dagger.io/docker" "universe.dagger.io/python" ) dagger.#Plan & { actions: test: { + // Run with a custom path to python + customPath: { + + // python:3.10-alpine has both python3 and python in the PATH + _image: docker.#Pull & { + source: "python:3.10-alpine" + } + run: python.#Run & { + input: _image.output + command: name: "python" + script: contents: #"print("Hello, world!")"# + } + // This needs no output test because it is only testing that the command runs + } + // Run a script from source directory + filename runFile: {