mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-86247 Introduced an ability to choose folder that contains python binary instead of direct searching of file
GitOrigin-RevId: 20ab5cb28abd08fe05c528f11583bb9f37706926
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d6698abecb
commit
887d6b9b74
@@ -129,18 +129,33 @@ class VirtualEnvReader private constructor(
|
||||
|
||||
|
||||
/**
|
||||
* [dir] is root directory of python installation or virtualenv
|
||||
* [pathOrDir] is either a direct path to a Python binary or a root directory of python installation or virtualenv
|
||||
*/
|
||||
@RequiresBackgroundThread
|
||||
fun findPythonInPythonRoot(dir: PythonHomePath): PythonBinary? {
|
||||
fun findPythonInPythonRoot(pathOrDir: PythonHomePath): PythonBinary? {
|
||||
val pythonNames = when (forcedOs ?: pathOrDir.getEelDescriptor().osFamily) {
|
||||
EelOsFamily.Posix -> POSIX_BINS
|
||||
EelOsFamily.Windows -> WIN_BINS
|
||||
}
|
||||
if (pathOrDir.isRegularFile() && pathOrDir.name.lowercase() in pythonNames) {
|
||||
return pathOrDir
|
||||
}
|
||||
|
||||
val bin = dir.resolve("bin")
|
||||
findInterpreter(bin)?.let { return it }
|
||||
if (!pathOrDir.isDirectory()) {
|
||||
return null
|
||||
}
|
||||
|
||||
val scripts = dir.resolve("Scripts")
|
||||
findInterpreter(scripts)?.let { return it }
|
||||
val bin = pathOrDir.resolve("bin")
|
||||
if (bin.isDirectory()) {
|
||||
findInterpreter(bin)?.let { return it }
|
||||
}
|
||||
|
||||
return findInterpreter(dir)
|
||||
val scripts = pathOrDir.resolve("Scripts")
|
||||
if (scripts.isDirectory()) {
|
||||
findInterpreter(scripts)?.let { return it }
|
||||
}
|
||||
|
||||
return findInterpreter(pathOrDir)
|
||||
}
|
||||
|
||||
fun getVenvRootPath(path: Path): Path? {
|
||||
|
||||
Reference in New Issue
Block a user