mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
base_path = sys.argv.pop()
|
||||
sys.path.insert(0, base_path)
|
||||
from fix_getpass import fixGetpass
|
||||
import os
|
||||
from django.core.management import execute_manager
|
||||
@@ -14,5 +17,5 @@ if not manage_file:
|
||||
|
||||
if __name__ == "__main__":
|
||||
fixGetpass()
|
||||
run_module(manage_file, None, '__main__')
|
||||
run_module(manage_file, None, '__main__', True)
|
||||
|
||||
|
||||
@@ -11,11 +11,13 @@ if not manage_file:
|
||||
|
||||
settings_file = os.getenv('DJANGO_SETTINGS_MODULE')
|
||||
if not settings_file:
|
||||
settings_file = 'settings'
|
||||
settings_file = 'settings'
|
||||
|
||||
proj_name = sys.argv[-1]
|
||||
|
||||
base_path = sys.argv.pop()
|
||||
proj_name = base_path.split("/")[-1]
|
||||
sys.path.insert(0, base_path)
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE',proj_name+".settings")
|
||||
|
||||
from django.core import management
|
||||
from django.core.management.commands.test import Command
|
||||
from django.conf import settings
|
||||
@@ -37,9 +39,9 @@ class PycharmTestCommand(Command):
|
||||
# handle south migration in tests
|
||||
management.get_commands()
|
||||
if hasattr(settings, "SOUTH_TESTS_MIGRATE") and not settings.SOUTH_TESTS_MIGRATE:
|
||||
# point at the core syncdb command when creating tests
|
||||
# tests should always be up to date with the most recent model structure
|
||||
management._commands['syncdb'] = 'django.core'
|
||||
# point at the core syncdb command when creating tests
|
||||
# tests should always be up to date with the most recent model structure
|
||||
management._commands['syncdb'] = 'django.core'
|
||||
else:
|
||||
try:
|
||||
from south.management.commands import MigrateAndSyncCommand
|
||||
@@ -97,7 +99,7 @@ if __name__ == "__main__":
|
||||
subcommand = 'help' # Display help if no arguments were given.
|
||||
|
||||
if subcommand == 'test':
|
||||
utility = PycharmTestManagementUtility(sys.argv[:-1])
|
||||
utility = PycharmTestManagementUtility(sys.argv)
|
||||
else:
|
||||
utility = ManagementUtility()
|
||||
utility.execute()
|
||||
@@ -84,13 +84,20 @@ public class PyDebugSupportUtils {
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isContinuationLine(@NotNull Document document, int line) {
|
||||
@Nullable
|
||||
private static String getLineText(@NotNull Document document, int line) {
|
||||
if (line > 0 && line < document.getLineCount()) {
|
||||
String text = document.getText(TextRange.create(document.getLineStartOffset(line), document.getLineEndOffset(line)));
|
||||
if (text.trim().endsWith("\\")) {
|
||||
return true;
|
||||
}
|
||||
return document.getText(TextRange.create(document.getLineStartOffset(line), document.getLineEndOffset(line)));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isContinuationLine(@NotNull Document document, int line) {
|
||||
String text = getLineText(document, line);
|
||||
if (text != null && text.trim().endsWith("\\")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.psi.PyCallExpression;
|
||||
import com.jetbrains.python.psi.PyElement;
|
||||
import com.jetbrains.python.psi.PyExpression;
|
||||
import com.jetbrains.python.psi.PyFunction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -40,14 +39,15 @@ public class PySmartStepIntoHandler extends XSmartStepIntoHandler<PySmartStepInt
|
||||
final Document document = FileDocumentManager.getInstance().getDocument(position.getFile());
|
||||
final List<PySmartStepIntoVariant> variants = Lists.newArrayList();
|
||||
final Set<PyCallExpression> visitedCalls = Sets.newHashSet();
|
||||
final Set<PyFunction> addedFunctions = Sets.newHashSet();
|
||||
|
||||
XDebuggerUtil.getInstance().iterateLine(mySession.getProject(), document, position.getLine(), new Processor<PsiElement>() {
|
||||
final int line = position.getLine();
|
||||
XDebuggerUtil.getInstance().iterateLine(mySession.getProject(), document, line, new Processor<PsiElement>() {
|
||||
public boolean process(PsiElement psiElement) {
|
||||
addVariants(psiElement, variants, visitedCalls, addedFunctions);
|
||||
addVariants(document, line, psiElement, variants, visitedCalls);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return variants;
|
||||
}
|
||||
|
||||
@@ -60,15 +60,16 @@ public class PySmartStepIntoHandler extends XSmartStepIntoHandler<PySmartStepInt
|
||||
return PyBundle.message("debug.popup.title.step.into.function");
|
||||
}
|
||||
|
||||
private static void addVariants(@Nullable PsiElement element,
|
||||
private static void addVariants(Document document, int line, @Nullable PsiElement element,
|
||||
List<PySmartStepIntoVariant> variants,
|
||||
Set<PyCallExpression> visited,
|
||||
Set<PyFunction> addedFunctions) {
|
||||
Set<PyCallExpression> visited) {
|
||||
if (element == null) return;
|
||||
|
||||
final PyCallExpression expression = PsiTreeUtil.getParentOfType(element, PyCallExpression.class);
|
||||
if (expression != null && visited.add(expression)) {
|
||||
addVariants(expression.getParent(), variants, visited, addedFunctions);
|
||||
if (expression != null &&
|
||||
expression.getTextRange().getEndOffset() <= document.getLineEndOffset(line) &&
|
||||
visited.add(expression)) {
|
||||
addVariants(document, line, expression.getParent(), variants, visited);
|
||||
PyExpression ref = expression.getCallee();
|
||||
|
||||
variants.add(new PySmartStepIntoVariant(ref));
|
||||
|
||||
@@ -306,13 +306,21 @@ public abstract class PythonCommandLineState extends CommandLineState {
|
||||
|
||||
private static void addToPythonPath(VirtualFile file, Collection<String> pathList) {
|
||||
if (file.getFileSystem() instanceof JarFileSystem) {
|
||||
VirtualFile realFile = JarFileSystem.getInstance().getVirtualFileForJar(file);
|
||||
final VirtualFile realFile = JarFileSystem.getInstance().getVirtualFileForJar(file);
|
||||
if (realFile != null) {
|
||||
pathList.add(FileUtil.toSystemDependentName(realFile.getPath()));
|
||||
addIfNeeded(realFile, pathList);
|
||||
}
|
||||
}
|
||||
else {
|
||||
pathList.add(FileUtil.toSystemDependentName(file.getPath()));
|
||||
addIfNeeded(file, pathList);
|
||||
}
|
||||
}
|
||||
|
||||
private static void addIfNeeded(@NotNull final VirtualFile file, @NotNull final Collection<String> pathList) {
|
||||
final Set<String> vals = Sets.newHashSet(pathList);
|
||||
final String filePath = FileUtil.toSystemDependentName(file.getPath());
|
||||
if (!vals.contains(filePath)) {
|
||||
pathList.add(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,9 +331,14 @@ public abstract class PythonCommandLineState extends CommandLineState {
|
||||
|
||||
@NotNull
|
||||
public static Collection<String> collectPythonPath(@Nullable Module module) {
|
||||
return collectPythonPath(module, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Collection<String> collectPythonPath(@Nullable Module module, final boolean addProjectRoots) {
|
||||
Collection<String> pythonPathList = Sets.newLinkedHashSet();
|
||||
pythonPathList.add(PythonHelpersLocator.getHelpersRoot().getPath());
|
||||
if (module != null) {
|
||||
if (module != null && addProjectRoots) {
|
||||
addLibrariesFromModule(module, pythonPathList);
|
||||
Set<Module> dependencies = new HashSet<Module>();
|
||||
ModuleUtil.getDependencies(module, dependencies);
|
||||
|
||||
@@ -142,8 +142,13 @@ public class PythonTask {
|
||||
}
|
||||
|
||||
protected List<String> setupPythonPath() {
|
||||
List<String> pythonPath = Lists.newArrayList(PythonCommandLineState.getAddedPaths(mySdk));
|
||||
pythonPath.addAll(PythonCommandLineState.collectPythonPath(myModule));
|
||||
return setupPythonPath(true);
|
||||
}
|
||||
|
||||
protected List<String> setupPythonPath(final boolean addProjectRoot) {
|
||||
final List<String> pythonPath = Lists.newArrayList(PythonCommandLineState.getAddedPaths(mySdk));
|
||||
if (addProjectRoot)
|
||||
pythonPath.addAll(PythonCommandLineState.collectPythonPath(myModule));
|
||||
return pythonPath;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user