mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Python Env Tests: support python.exe from Windows Apps in PYTHON_FOR_TESTS
GitOrigin-RevId: dc3c04ab43749a1c02285ccdc4deab01f49b13c1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1591012fe0
commit
956af7d0aa
@@ -10,7 +10,9 @@ import com.jetbrains.python.PythonHomePath
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import java.io.IOException
|
||||
import java.nio.file.FileSystemException
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.attribute.BasicFileAttributes
|
||||
import kotlin.io.path.*
|
||||
|
||||
typealias Directory = Path
|
||||
@@ -151,7 +153,19 @@ class VirtualEnvReader(
|
||||
*/
|
||||
@RequiresBackgroundThread
|
||||
private fun findInterpreter(dir: Path): PythonBinary? =
|
||||
dir.listDirectoryEntries().firstOrNull { it.isRegularFile() && it.name.lowercase() in pythonNames }
|
||||
dir.listDirectoryEntries().firstOrNull { child ->
|
||||
if (child.name.lowercase() !in pythonNames) {
|
||||
return@firstOrNull false
|
||||
}
|
||||
try {
|
||||
child.readAttributes<BasicFileAttributes>().isRegularFile
|
||||
}
|
||||
catch (err: FileSystemException) {
|
||||
// Handling a possible reparse point from WindowsApps.
|
||||
if (SystemInfoRt.isWindows && err.javaClass == FileSystemException::class.java) true
|
||||
else throw err
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresBackgroundThread
|
||||
private fun resolveDirFromEnvOrElseGetDirInHomePath(env: String, dirName: String): Path =
|
||||
|
||||
Reference in New Issue
Block a user