universe: python: allow custom path to python

Closes #2114

Signed-off-by: Adam Smith <adamsmith@nottheeconomist.com>
This commit is contained in:
Adam Smith 2022-04-10 16:32:31 -07:00
parent e110ac05a2
commit 975413e793
No known key found for this signature in database
GPG Key ID: 2ABA83702C3D3EDB
2 changed files with 17 additions and 2 deletions

View File

@ -42,7 +42,7 @@ import (
docker.#Run & { docker.#Run & {
command: { command: {
name: "python3" name: string | *"python3"
"args": ["\(_mountpoint)/\(script._filename)"] + args "args": ["\(_mountpoint)/\(script._filename)"] + args
} }

View File

@ -3,13 +3,28 @@ package python
import ( import (
"dagger.io/dagger" "dagger.io/dagger"
"dagger.io/dagger/core" "dagger.io/dagger/core"
"universe.dagger.io/docker"
"universe.dagger.io/python" "universe.dagger.io/python"
) )
dagger.#Plan & { dagger.#Plan & {
actions: test: { 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 // Run a script from source directory + filename
runFile: { runFile: {