Skip to content

Commit f83f73e

Browse files
committed
Export PYENV_VERSION rather than using pyenv shell
This is needed to support pyenv on Windows.
1 parent 8f0f23b commit f83f73e

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/com/ableton/Pyenv.groovy

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,21 @@ class Pyenv implements Serializable {
6262

6363
VirtualEnv venv = new VirtualEnv(script, randomSeed)
6464
script.retry(INSTALLATION_RETRIES) {
65-
List installCommands = [
66-
"export PYENV_ROOT=${pyenvRoot}",
67-
"export PATH=\$PYENV_ROOT/bin:\$PATH",
68-
'eval "\$(pyenv init --path)"',
69-
'eval "\$(pyenv init -)"',
70-
"pyenv install --skip-existing ${trimmedPythonVersion}",
71-
"pyenv shell ${trimmedPythonVersion}",
72-
'pyenv exec pip install virtualenv',
73-
"pyenv exec virtualenv ${venv.venvRootDir}",
74-
]
75-
venv.script.sh(
76-
label: "Install Python version ${trimmedPythonVersion} with pyenv",
77-
script: installCommands.join('\n') + '\n',
78-
)
65+
script.withEnv(["PYENV_VERSION=${trimmedPythonVersion}"]) {
66+
List installCommands = [
67+
"export PYENV_ROOT=${pyenvRoot}",
68+
"export PATH=\$PYENV_ROOT/bin:\$PATH",
69+
'eval "\$(pyenv init --path)"',
70+
'eval "\$(pyenv init -)"',
71+
"pyenv install --skip-existing ${trimmedPythonVersion}",
72+
'pyenv exec pip install virtualenv',
73+
"pyenv exec virtualenv ${venv.venvRootDir}",
74+
]
75+
venv.script.sh(
76+
label: "Install Python version ${trimmedPythonVersion} with pyenv",
77+
script: installCommands.join('\n') + '\n',
78+
)
79+
}
7980
}
8081

8182
return venv

test/com/ableton/PyenvTest.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ class PyenvTest extends BasePipelineTest {
152152
'eval "\$(pyenv init --path)"',
153153
'eval "\$(pyenv init -)"',
154154
"pyenv install --skip-existing ${pythonVersion}",
155-
"pyenv shell ${pythonVersion}",
156155
'pyenv exec pip install virtualenv',
157156
"pyenv exec virtualenv /workspace/.venv/${TEST_RANDOM_NAME}",
158157
]

0 commit comments

Comments
 (0)