From 7bc4243e55c4d36d638da705552ac6418ab166b9 Mon Sep 17 00:00:00 2001 From: Aleksey Rostovskiy Date: Fri, 15 Dec 2017 12:40:42 +0300 Subject: [PATCH] fix problem with existing links in EnvTests --- python/setup-test-environment/build.gradle | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/python/setup-test-environment/build.gradle b/python/setup-test-environment/build.gradle index fff21e841f39..5d0c0ec63590 100644 --- a/python/setup-test-environment/build.gradle +++ b/python/setup-test-environment/build.gradle @@ -58,12 +58,16 @@ envs { if (createLink) { String linkName = "python${version.split(/\./)[0..1].join(".")}" + Closure createLinkClosure = { java.nio.file.Path link, java.nio.file.Path existing -> + if (!link.toFile().exists()) Files.createLink(link, existing) + } + if (Os.isFamily(Os.FAMILY_UNIX) && !shouldUseCondaInterpreters) { - Files.createLink(Paths.get(pythonDirectory.toString(), linkName), - Paths.get(pythonDirectory.toString(), "bin/$linkName")) + createLinkClosure(Paths.get(pythonDirectory.toString(), linkName), + Paths.get(pythonDirectory.toString(), "bin/$linkName")) } else if (Os.isFamily(Os.FAMILY_WINDOWS)) { - Files.createLink(Paths.get(pythonDirectory.toString(), "${linkName}.exe"), - Paths.get(pythonDirectory.toString(), "python.exe")) + createLinkClosure(Paths.get(pythonDirectory.toString(), "${linkName}.exe"), + Paths.get(pythonDirectory.toString(), "python.exe")) } } }