Skip to content

Commit

Permalink
universe: python: allow custom path to python
Browse files Browse the repository at this point in the history
Closes #2114

Signed-off-by: Adam Smith <adamsmith@nottheeconomist.com>
  • Loading branch information
NotTheEconomist committed Apr 11, 2022
1 parent e110ac0 commit 975413e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/universe.dagger.io/python/python.cue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (

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

Expand Down
17 changes: 16 additions & 1 deletion pkg/universe.dagger.io/python/test/test.cue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {

Expand Down

0 comments on commit 975413e

Please sign in to comment.