correctly locate helpers under new repo layout

This commit is contained in:
Dmitry Jemerov
2013-10-18 18:58:28 +02:00
parent e46168dc3a
commit fd9da876e5
7 changed files with 18 additions and 17 deletions
@@ -1,6 +1,7 @@
package com.jetbrains.rest;
import com.intellij.testFramework.ParsingTestCase;
import com.jetbrains.python.PythonHelpersLocator;
import com.jetbrains.python.fixtures.PyTestCase;
import com.jetbrains.rest.parsing.RestParserDefinition;
@@ -35,7 +36,7 @@ public class RestParsingTest extends ParsingTestCase {
}
protected String getTestDataPath() {
return PyTestCase.getPythonCommunityPath() + "/python-rest/testData/psi";
return PythonHelpersLocator.getPythonCommunityPath() + "/python-rest/testData/psi";
}
@@ -8,6 +8,7 @@ import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
import com.intellij.testFramework.fixtures.TestFixtureBuilder;
import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl;
import com.jetbrains.python.PythonHelpersLocator;
import com.jetbrains.python.fixtures.PyTestCase;
import org.jetbrains.annotations.Nullable;
@@ -33,7 +34,7 @@ public abstract class RestFixtureTestCase extends UsefulTestCase {
}
protected String getTestDataPath() {
return PyTestCase.getPythonCommunityPath() + "/python-rest/testData";
return PythonHelpersLocator.getPythonCommunityPath() + "/python-rest/testData";
}
@Override
@@ -1,5 +1,6 @@
package com.jetbrains.python;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.PathUtil;
import org.jetbrains.annotations.NonNls;
@@ -52,4 +53,11 @@ public class PythonHelpersLocator {
return new File(getHelpersRoot(), resourceName);
}
public static String getPythonCommunityPath() {
File pathFromUltimate = new File(PathManager.getHomePath(), "community/python");
if (pathFromUltimate.exists()) {
return pathFromUltimate.getPath();
}
return new File(PathManager.getHomePath(), "python").getPath();
}
}
@@ -44,7 +44,7 @@ public class PyUserSkeletonsUtil {
final List<String> result = new ArrayList<String>();
result.add(PathManager.getConfigPath() + File.separator + USER_SKELETONS_DIR);
result.add(ApplicationManager.getApplication().isInternal()
? StringUtil.join(new String[]{PathManager.getHomePath(), "python", "community", "helpers", USER_SKELETONS_DIR}, File.separator)
? StringUtil.join(new String[]{PythonHelpersLocator.getPythonCommunityPath(), "helpers", USER_SKELETONS_DIR}, File.separator)
: PythonHelpersLocator.getHelperPath(USER_SKELETONS_DIR));
return result;
}
@@ -1,7 +1,5 @@
package com.jetbrains.python;
import com.jetbrains.python.fixtures.PyTestCase;
/**
* @author yole
*/
@@ -10,6 +8,6 @@ public class PythonTestUtil {
}
public static String getTestDataPath() {
return PyTestCase.getPythonCommunityPath() + "/testData";
return PythonHelpersLocator.getPythonCommunityPath() + "/testData";
}
}
@@ -22,6 +22,7 @@ import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
import com.intellij.testFramework.fixtures.TestFixtureBuilder;
import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl;
import com.jetbrains.python.PythonHelpersLocator;
import com.jetbrains.python.PythonMockSdk;
import com.jetbrains.python.PythonTestUtil;
import com.jetbrains.python.psi.LanguageLevel;
@@ -149,15 +150,7 @@ public abstract class PyTestCase extends UsefulTestCase {
PlatformTestCase.autodetectPlatformPrefix();
}
public static String getPythonCommunityPath() {
File pathFromUltimate = new File(PathManager.getHomePath(), "community/python");
if (pathFromUltimate.exists()) {
return pathFromUltimate.getPath();
}
return new File(PathManager.getHomePath(), "python").getPath();
}
public static String getHelpersPath() {
return new File(getPythonCommunityPath(), "helpers").getPath();
return new File(PythonHelpersLocator.getPythonCommunityPath(), "helpers").getPath();
}
}
@@ -9,7 +9,7 @@ import com.intellij.openapi.projectRoots.JdkUtil;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SimpleJavaSdkType;
import com.intellij.util.SystemProperties;
import com.jetbrains.python.fixtures.PyTestCase;
import com.jetbrains.python.PythonHelpersLocator;
import java.io.File;
@@ -27,7 +27,7 @@ public class JythonUnitTestUtil {
parameters.setJdk(ideaJdk);
parameters.setMainClass("org.python.util.jython");
File jythonJar = new File(PyTestCase.getPythonCommunityPath(), "lib/jython.jar");
File jythonJar = new File(PythonHelpersLocator.getPythonCommunityPath(), "lib/jython.jar");
parameters.getClassPath().add(jythonJar.getPath());
parameters.getProgramParametersList().add("-Dpython.path=" + pythonPath + File.pathSeparator + workDir);