in src/main/groovy/com/jetbrains/python/envs/PythonEnvsPlugin.groovy [109:152]
private static Task createInstallPythonBuildTask(Project project, File installDir) {
return project.tasks.create(name: 'install_python_build') {
onlyIf {
isUnix && !installDir.exists()
}
doFirst {
project.buildDir.mkdirs()
}
doLast {
new File(project.buildDir, "pyenv.zip").with { pyenvZip ->
project.logger.quiet("Downloading latest pyenv from github")
project.ant.get(dest: pyenvZip) {
url(url: "https://github.com/pyenv/pyenv/archive/master.zip")
}
File unzipFolder = new File(project.buildDir, "python-build-tmp")
String pathToPythonBuildInPyenv = "pyenv-master/plugins/python-build"
project.logger.quiet("Unzipping python-build to $unzipFolder")
project.copy {
from project.zipTree(pyenvZip)
into unzipFolder
include "$pathToPythonBuildInPyenv/**"
eachFile { file ->
file.path = file.path.replaceFirst(pathToPythonBuildInPyenv, '')
}
}
project.logger.quiet("Installing python-build via bash to $installDir")
project.exec {
commandLine "bash", new File(unzipFolder, "install.sh")
environment PREFIX: installDir
}
project.logger.quiet("Removing garbage")
unzipFolder.deleteDir()
pyenvZip.delete()
}
}
}
}