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:
@@ -33,6 +33,8 @@ setProperty("restSrcDir", "${pluginHome}/rest/src")
|
||||
setProperty("localizationSrcDir", "${pluginHome}/localization/src")
|
||||
|
||||
setProperty("resourcesDir", "${pluginHome}/resources")
|
||||
setProperty("restResourcesDir", "${pluginHome}/rest/resources")
|
||||
setProperty("localizationResourcesDir", "${pluginHome}/localization/resources")
|
||||
setProperty("pluginResourcesDir", "${pluginHome}/pluginResources")
|
||||
|
||||
setProperty("classesRootDir", "${outDir}/classes")
|
||||
@@ -131,6 +133,12 @@ target(name: "compileRest", description: "Compile module rest") {
|
||||
type(type: "file")
|
||||
}
|
||||
}
|
||||
ant.copy(todir: "${restClassesDir}") {
|
||||
fileset(dir: "${restResourcesDir}") {
|
||||
patternset(refid: "resources.pt")
|
||||
type(type: "file")
|
||||
}
|
||||
}
|
||||
|
||||
//copy plugin.xml
|
||||
ant.mkdir(dir: "${restClassesDir}/META-INF")
|
||||
@@ -193,6 +201,12 @@ target(name: "compileLocalization", description: "Compile module localization")
|
||||
type(type: "file")
|
||||
}
|
||||
}
|
||||
ant.copy(todir: "${localizationClassesDir}") {
|
||||
fileset(dir: "${localizationResourcesDir}") {
|
||||
patternset(refid: "resources.pt")
|
||||
type(type: "file")
|
||||
}
|
||||
}
|
||||
|
||||
//copy plugin.xml
|
||||
ant.mkdir(dir: "${localizationClassesDir}/META-INF")
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
# on win32, redefines getpass from too clandestine to more explicit
|
||||
import sys
|
||||
def fixGetpass():
|
||||
if sys.platform == 'win32':
|
||||
import getpass
|
||||
import warnings
|
||||
fallback = getattr(getpass, 'fallback_getpass', None) # >= 2.6
|
||||
if not fallback:
|
||||
fallback = getpass.default_getpass # <= 2.5
|
||||
getpass.getpass = fallback
|
||||
if hasattr(getpass, 'GetPassWarning'):
|
||||
warnings.simplefilter("ignore", category=getpass.GetPassWarning)
|
||||
import getpass
|
||||
import warnings
|
||||
fallback = getattr(getpass, 'fallback_getpass', None) # >= 2.6
|
||||
if not fallback:
|
||||
fallback = getpass.default_getpass # <= 2.5
|
||||
getpass.getpass = fallback
|
||||
if hasattr(getpass, 'GetPassWarning'):
|
||||
warnings.simplefilter("ignore", category=getpass.GetPassWarning)
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
def fixGetpass():
|
||||
import getpass
|
||||
import warnings
|
||||
fallback = getattr(getpass, 'fallback_getpass', None) # >= 2.6
|
||||
if not fallback:
|
||||
fallback = getpass.default_getpass # <= 2.5
|
||||
getpass.getpass = fallback
|
||||
if hasattr(getpass, 'GetPassWarning'):
|
||||
warnings.simplefilter("ignore", category=getpass.GetPassWarning)
|
||||
|
||||
@@ -14,6 +14,8 @@ else:
|
||||
import threading
|
||||
|
||||
import traceback
|
||||
import fix_getpass
|
||||
fix_getpass.fixGetpass()
|
||||
|
||||
try:
|
||||
if USE_LIB_COPY:
|
||||
|
||||
@@ -5,6 +5,7 @@ from pydevd_frame import add_exception_to_frame
|
||||
from pydevd_constants import * #@UnusedWildImport
|
||||
import pydev_imports
|
||||
from pydevd_breakpoints import * #@UnusedWildImport
|
||||
import fix_getpass
|
||||
|
||||
from pydevd_comm import CMD_CHANGE_VARIABLE, \
|
||||
CMD_EVALUATE_EXPRESSION, \
|
||||
@@ -1433,6 +1434,8 @@ if __name__ == '__main__':
|
||||
import pydevd_psyco_stub
|
||||
sys.modules['psyco'] = pydevd_psyco_stub
|
||||
|
||||
fix_getpass.fixGetpass()
|
||||
|
||||
|
||||
pydev_log.debug("Executing file %s" % setup['file'])
|
||||
pydev_log.debug("arguments: %s"% str(sys.argv))
|
||||
|
||||
@@ -143,4 +143,6 @@ else:
|
||||
except:
|
||||
#If all fails, let's use the support without frames
|
||||
PyDBAdditionalThreadInfo = PyDBAdditionalThreadInfoWithoutCurrentFramesSupport
|
||||
|
||||
|
||||
sys.stderr.write("pydev debugger: warning: sys._current_frames is not supported in Python 2.4, it is recommended to install threadframe module\n")
|
||||
sys.stderr.write("pydev debugger: warning: See http://majid.info/blog/threadframe-multithreaded-stack-frame-extraction-for-python/\n")
|
||||
|
||||
@@ -164,6 +164,8 @@ class DefaultResolver:
|
||||
filterBuiltIn = True
|
||||
|
||||
names = dir(var)
|
||||
if not names and hasattr(var, '__members__'):
|
||||
names = var.__members__
|
||||
d = {}
|
||||
|
||||
#Be aware that the order in which the filters are applied attempts to
|
||||
|
||||
@@ -24,9 +24,10 @@ public abstract class PyStubElementType<StubT extends StubElement, PsiT extends
|
||||
|
||||
public abstract PsiElement createElement(@NotNull final ASTNode node);
|
||||
|
||||
public void indexStub(final StubT stub, final IndexSink sink) {
|
||||
public void indexStub(@NotNull final StubT stub, @NotNull final IndexSink sink) {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getExternalId() {
|
||||
return "py." + super.toString();
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory<PythonC
|
||||
return envs;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected List<AnAction> fillToolBarActions(final DefaultActionGroup toolbarActions,
|
||||
final Executor defaultExecutor,
|
||||
@@ -378,9 +379,6 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory<PythonC
|
||||
}
|
||||
|
||||
fireConsoleInitializedEvent(consoleView);
|
||||
|
||||
|
||||
requestFocus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.jetbrains.python.documentation.doctest;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.jetbrains.python.psi.PyFileElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* User : ktisha
|
||||
@@ -11,6 +12,7 @@ public class PyDocstringFileElementType extends PyFileElementType {
|
||||
super(language);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getExternalId() {
|
||||
return "PyDocstring.FILE";
|
||||
|
||||
@@ -109,7 +109,7 @@ public class PyTypeCheckerInspection extends PyInspection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inspectionFinished(LocalInspectionToolSession session, ProblemsHolder problemsHolder) {
|
||||
public void inspectionFinished(@NotNull LocalInspectionToolSession session, @NotNull ProblemsHolder problemsHolder) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
final Long startTime = session.getUserData(TIME_KEY);
|
||||
if (startTime != null) {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class PyUnresolvedReferencesInspection extends PyInspection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inspectionFinished(LocalInspectionToolSession session, ProblemsHolder holder) {
|
||||
public void inspectionFinished(@NotNull LocalInspectionToolSession session, @NotNull ProblemsHolder holder) {
|
||||
final Visitor visitor = session.getUserData(KEY);
|
||||
assert visitor != null;
|
||||
if (PyCodeInsightSettings.getInstance().HIGHLIGHT_UNUSED_IMPORTS) {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PyUnusedLocalInspection extends PyInspection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inspectionFinished(LocalInspectionToolSession session, ProblemsHolder holder) {
|
||||
public void inspectionFinished(@NotNull LocalInspectionToolSession session, @NotNull ProblemsHolder holder) {
|
||||
final PyUnusedLocalInspectionVisitor visitor = session.getUserData(KEY);
|
||||
if (visitor != null) {
|
||||
visitor.registerProblems();
|
||||
|
||||
@@ -128,20 +128,22 @@ public class PyFileElementType extends IStubFileElementType<PyFileStub> {
|
||||
return ((PyFile)file).getLanguageLevel();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getExternalId() {
|
||||
return "python.FILE";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(PyFileStub stub, StubOutputStream dataStream) throws IOException {
|
||||
public void serialize(@NotNull PyFileStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
writeNullableList(dataStream, stub.getDunderAll());
|
||||
writeBitSet(dataStream, stub.getFutureFeatures());
|
||||
dataStream.writeName(stub.getDeprecationMessage());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PyFileStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
public PyFileStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
List<String> all = readNullableList(dataStream);
|
||||
BitSet future_features = readBitSet(dataStream);
|
||||
StringRef deprecationMessage = dataStream.readName();
|
||||
|
||||
@@ -38,11 +38,12 @@ public class PyAnnotationElementType extends PyStubElementType<PyAnnotationStub,
|
||||
return new PyAnnotationImpl(node);
|
||||
}
|
||||
|
||||
public void serialize(final PyAnnotationStub stub, final StubOutputStream dataStream)
|
||||
public void serialize(@NotNull final PyAnnotationStub stub, @NotNull final StubOutputStream dataStream)
|
||||
throws IOException {
|
||||
}
|
||||
|
||||
public PyAnnotationStub deserialize(final StubInputStream dataStream, final StubElement parentStub)
|
||||
@NotNull
|
||||
public PyAnnotationStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub)
|
||||
throws IOException {
|
||||
return new PyAnnotationStubImpl(parentStub, PyElementTypes.ANNOTATION);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PyClassElementType extends PyStubElementType<PyClassStub, PyClass>
|
||||
getStubElementType());
|
||||
}
|
||||
|
||||
public void serialize(final PyClassStub pyClassStub, final StubOutputStream dataStream) throws IOException {
|
||||
public void serialize(@NotNull final PyClassStub pyClassStub, @NotNull final StubOutputStream dataStream) throws IOException {
|
||||
dataStream.writeName(pyClassStub.getName());
|
||||
final PyQualifiedName[] classes = pyClassStub.getSuperClasses();
|
||||
dataStream.writeByte(classes.length);
|
||||
@@ -66,7 +66,8 @@ public class PyClassElementType extends PyStubElementType<PyClassStub, PyClass>
|
||||
dataStream.writeUTFFast(docString != null ? docString : "");
|
||||
}
|
||||
|
||||
public PyClassStub deserialize(final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
@NotNull
|
||||
public PyClassStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
String name = StringRef.toString(dataStream.readName());
|
||||
int superClassCount = dataStream.readByte();
|
||||
PyQualifiedName[] superClasses = new PyQualifiedName[superClassCount];
|
||||
@@ -78,7 +79,7 @@ public class PyClassElementType extends PyStubElementType<PyClassStub, PyClass>
|
||||
return new PyClassStubImpl(name, parentStub, superClasses, slots, docString.length() > 0 ? docString : null, getStubElementType());
|
||||
}
|
||||
|
||||
public void indexStub(final PyClassStub stub, final IndexSink sink) {
|
||||
public void indexStub(@NotNull final PyClassStub stub, @NotNull final IndexSink sink) {
|
||||
final String name = stub.getName();
|
||||
if (name != null) {
|
||||
sink.occurrence(PyClassNameIndex.KEY, name);
|
||||
|
||||
@@ -36,11 +36,12 @@ public class PyDecoratorCallElementType extends PyStubElementType<PyDecoratorStu
|
||||
return new PyDecoratorStubImpl(psi.getQualifiedName(), parentStub);
|
||||
}
|
||||
|
||||
public void serialize(PyDecoratorStub stub, StubOutputStream dataStream) throws IOException {
|
||||
public void serialize(@NotNull PyDecoratorStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
PyQualifiedName.serialize(stub.getQualifiedName(), dataStream);
|
||||
}
|
||||
|
||||
public PyDecoratorStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
@NotNull
|
||||
public PyDecoratorStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
PyQualifiedName q_name = PyQualifiedName.deserialize(dataStream);
|
||||
return new PyDecoratorStubImpl(q_name, parentStub);
|
||||
}
|
||||
|
||||
@@ -36,11 +36,12 @@ public class PyDecoratorListElementType extends PyStubElementType<PyDecoratorLis
|
||||
return new PyDecoratorListStubImpl(parentStub);
|
||||
}
|
||||
|
||||
public void serialize(final PyDecoratorListStub stub, final StubOutputStream dataStream) throws IOException {
|
||||
public void serialize(@NotNull final PyDecoratorListStub stub, @NotNull final StubOutputStream dataStream) throws IOException {
|
||||
// nothing
|
||||
}
|
||||
|
||||
public PyDecoratorListStub deserialize(final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
@NotNull
|
||||
public PyDecoratorListStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
return new PyDecoratorListStubImpl(parentStub);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,11 +37,12 @@ public class PyExceptPartElementType extends PyStubElementType<PyExceptPartStub,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(PyExceptPartStub stub, StubOutputStream dataStream) throws IOException {
|
||||
public void serialize(@NotNull PyExceptPartStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PyExceptPartStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
public PyExceptPartStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
return new PyExceptPartStubImpl(parentStub);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -44,14 +44,15 @@ public class PyFromImportStatementElementType extends PyStubElementType<PyFromIm
|
||||
getStubElementType());
|
||||
}
|
||||
|
||||
public void serialize(PyFromImportStatementStub stub, StubOutputStream dataStream) throws IOException {
|
||||
public void serialize(@NotNull PyFromImportStatementStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
final PyQualifiedName qName = stub.getImportSourceQName();
|
||||
PyQualifiedName.serialize(qName, dataStream);
|
||||
dataStream.writeBoolean(stub.isStarImport());
|
||||
dataStream.writeVarInt(stub.getRelativeLevel());
|
||||
}
|
||||
|
||||
public PyFromImportStatementStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
@NotNull
|
||||
public PyFromImportStatementStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
PyQualifiedName qName = PyQualifiedName.deserialize(dataStream);
|
||||
boolean isStarImport = dataStream.readBoolean();
|
||||
int relativeLevel = dataStream.readVarInt();
|
||||
|
||||
@@ -44,21 +44,22 @@ public class PyFunctionElementType extends PyStubElementType<PyFunctionStub, PyF
|
||||
message == null ? null : StringRef.fromString(message), parentStub, getStubElementType());
|
||||
}
|
||||
|
||||
public void serialize(final PyFunctionStub stub, final StubOutputStream dataStream)
|
||||
public void serialize(@NotNull final PyFunctionStub stub, @NotNull final StubOutputStream dataStream)
|
||||
throws IOException {
|
||||
dataStream.writeName(stub.getName());
|
||||
dataStream.writeUTFFast(stub.getDocString() != null ? stub.getDocString() : "");
|
||||
dataStream.writeName(stub.getDeprecationMessage());
|
||||
}
|
||||
|
||||
public PyFunctionStub deserialize(final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
@NotNull
|
||||
public PyFunctionStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
String name = StringRef.toString(dataStream.readName());
|
||||
String docString = dataStream.readUTFFast();
|
||||
StringRef deprecationMessage = dataStream.readName();
|
||||
return new PyFunctionStubImpl(name, docString.length() > 0 ? docString : null, deprecationMessage, parentStub, getStubElementType());
|
||||
}
|
||||
|
||||
public void indexStub(final PyFunctionStub stub, final IndexSink sink) {
|
||||
public void indexStub(@NotNull final PyFunctionStub stub, @NotNull final IndexSink sink) {
|
||||
final String name = stub.getName();
|
||||
if (name != null) {
|
||||
sink.occurrence(PyFunctionNameIndex.KEY, name);
|
||||
|
||||
@@ -46,12 +46,13 @@ public class PyImportElementElementType extends PyStubElementType<PyImportElemen
|
||||
return new PyImportElementStubImpl(psi.getImportedQName(), asName != null ? asName.getName() : "", parentStub, getStubElementType());
|
||||
}
|
||||
|
||||
public void serialize(PyImportElementStub stub, StubOutputStream dataStream) throws IOException {
|
||||
public void serialize(@NotNull PyImportElementStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
PyQualifiedName.serialize(stub.getImportedQName(), dataStream);
|
||||
dataStream.writeName(stub.getAsName());
|
||||
}
|
||||
|
||||
public PyImportElementStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
@NotNull
|
||||
public PyImportElementStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
PyQualifiedName qName = PyQualifiedName.deserialize(dataStream);
|
||||
StringRef asName = dataStream.readName();
|
||||
return new PyImportElementStubImpl(qName, asName.getString(), parentStub, getStubElementType());
|
||||
|
||||
@@ -42,10 +42,11 @@ public class PyImportStatementElementType extends PyStubElementType<PyImportStat
|
||||
return new PyImportStatementStubImpl(parentStub, getStubElementType());
|
||||
}
|
||||
|
||||
public void serialize(PyImportStatementStub stub, StubOutputStream dataStream) throws IOException {
|
||||
public void serialize(@NotNull PyImportStatementStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
}
|
||||
|
||||
public PyImportStatementStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
@NotNull
|
||||
public PyImportStatementStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
return new PyImportStatementStubImpl(parentStub, getStubElementType());
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PyNamedParameterElementType extends PyStubElementType<PyNamedParame
|
||||
return new PyNamedParameterImpl(node);
|
||||
}
|
||||
|
||||
public void serialize(final PyNamedParameterStub stub, final StubOutputStream dataStream)
|
||||
public void serialize(@NotNull final PyNamedParameterStub stub, @NotNull final StubOutputStream dataStream)
|
||||
throws IOException {
|
||||
dataStream.writeName(stub.getName());
|
||||
|
||||
@@ -56,7 +56,8 @@ public class PyNamedParameterElementType extends PyStubElementType<PyNamedParame
|
||||
dataStream.writeByte(flags);
|
||||
}
|
||||
|
||||
public PyNamedParameterStub deserialize(final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
@NotNull
|
||||
public PyNamedParameterStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
String name = StringRef.toString(dataStream.readName());
|
||||
byte flags = dataStream.readByte();
|
||||
return new PyNamedParameterStubImpl(name,
|
||||
|
||||
@@ -39,11 +39,12 @@ public class PyParameterListElementType extends PyStubElementType<PyParameterLis
|
||||
return new PyParameterListImpl(node);
|
||||
}
|
||||
|
||||
public void serialize(final PyParameterListStub stub, final StubOutputStream dataStream)
|
||||
public void serialize(@NotNull final PyParameterListStub stub, @NotNull final StubOutputStream dataStream)
|
||||
throws IOException {
|
||||
}
|
||||
|
||||
public PyParameterListStub deserialize(final StubInputStream dataStream, final StubElement parentStub)
|
||||
@NotNull
|
||||
public PyParameterListStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub)
|
||||
throws IOException {
|
||||
return new PyParameterListStubImpl(parentStub, getStubElementType());
|
||||
}
|
||||
|
||||
+3
-2
@@ -36,10 +36,11 @@ public class PySingleStarParameterElementType extends PyStubElementType<PySingle
|
||||
return new PySingleStarParameterStubImpl(parentStub);
|
||||
}
|
||||
|
||||
public void serialize(PySingleStarParameterStub stub, StubOutputStream dataStream) throws IOException {
|
||||
public void serialize(@NotNull PySingleStarParameterStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
}
|
||||
|
||||
public PySingleStarParameterStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
@NotNull
|
||||
public PySingleStarParameterStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
return new PySingleStarParameterStubImpl(parentStub);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class PyTargetExpressionElementType extends PyStubElementType<PyTargetExp
|
||||
return new PyTargetExpressionStubImpl(name, initializerType, initializer, psi.getQualifier() != null, parentStub);
|
||||
}
|
||||
|
||||
public void serialize(final PyTargetExpressionStub stub, final StubOutputStream stream)
|
||||
public void serialize(@NotNull final PyTargetExpressionStub stub, @NotNull final StubOutputStream stream)
|
||||
throws IOException {
|
||||
stream.writeName(stub.getName());
|
||||
stream.writeVarInt(stub.getInitializerType().getIndex());
|
||||
@@ -85,7 +85,8 @@ public class PyTargetExpressionElementType extends PyStubElementType<PyTargetExp
|
||||
}
|
||||
}
|
||||
|
||||
public PyTargetExpressionStub deserialize(final StubInputStream stream, final StubElement parentStub)
|
||||
@NotNull
|
||||
public PyTargetExpressionStub deserialize(@NotNull final StubInputStream stream, final StubElement parentStub)
|
||||
throws IOException {
|
||||
String name = StringRef.toString(stream.readName());
|
||||
PyTargetExpressionStub.InitializerType initializerType = PyTargetExpressionStub.InitializerType.fromIndex(stream.readVarInt());
|
||||
@@ -126,7 +127,7 @@ public class PyTargetExpressionElementType extends PyStubElementType<PyTargetExp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void indexStub(PyTargetExpressionStub stub, IndexSink sink) {
|
||||
public void indexStub(@NotNull PyTargetExpressionStub stub, @NotNull IndexSink sink) {
|
||||
String name = stub.getName();
|
||||
if (name != null && PyUtil.getInitialUnderscores(name) == 0) {
|
||||
if (stub.getParentStub() instanceof PyFileStub) {
|
||||
|
||||
@@ -34,12 +34,13 @@ public class PyTupleParameterElementType extends PyStubElementType<PyTupleParame
|
||||
return new PyTupleParameterStubImpl(psi.hasDefaultValue(), parentStub);
|
||||
}
|
||||
|
||||
public PyTupleParameterStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
@NotNull
|
||||
public PyTupleParameterStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
boolean hasDefaultValue = dataStream.readBoolean();
|
||||
return new PyTupleParameterStubImpl(hasDefaultValue, parentStub);
|
||||
}
|
||||
|
||||
public void serialize(PyTupleParameterStub stub, StubOutputStream dataStream) throws IOException {
|
||||
public void serialize(@NotNull PyTupleParameterStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
dataStream.writeBoolean(stub.hasDefaultValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.jetbrains.python.run;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.process.ProcessTerminatedListener;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.util.PathMappingSettings;
|
||||
import com.jetbrains.python.remote.PyRemoteSdkAdditionalData;
|
||||
import com.jetbrains.python.remote.PythonRemoteInterpreterManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author traff
|
||||
*/
|
||||
public class PyRemoteProcessStarter {
|
||||
public ProcessHandler startRemoteProcess(@NotNull Sdk sdk, @NotNull GeneralCommandLine commandLine, @Nullable Project project, @Nullable PathMappingSettings mappingSettings)
|
||||
throws ExecutionException {
|
||||
PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
|
||||
if (manager != null) {
|
||||
ProcessHandler processHandler;
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
processHandler = doStartRemoteProcess(sdk, commandLine, manager, project, mappingSettings);
|
||||
break;
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
if (Messages.showYesNoDialog(e.getMessage() + "\nTry again?", "Can't Run Remote Interpreter", Messages.getErrorIcon()) ==
|
||||
Messages.NO) {
|
||||
throw new ExecutionException("Can't run remote python interpreter: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
ProcessTerminatedListener.attach(processHandler);
|
||||
return processHandler;
|
||||
}
|
||||
else {
|
||||
throw new PythonRemoteInterpreterManager.PyRemoteInterpreterExecutionException();
|
||||
}
|
||||
}
|
||||
|
||||
protected ProcessHandler doStartRemoteProcess(@NotNull Sdk sdk,
|
||||
@NotNull GeneralCommandLine commandLine,
|
||||
@NotNull PythonRemoteInterpreterManager manager,
|
||||
@Nullable Project project,
|
||||
@Nullable PathMappingSettings settings)
|
||||
throws ExecutionException {
|
||||
|
||||
return manager.startRemoteProcess(project, (PyRemoteSdkAdditionalData)sdk.getSdkAdditionalData(), commandLine,
|
||||
settings);
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,9 @@ public abstract class PythonCommandLineState extends CommandLineState {
|
||||
|
||||
final ProcessHandler processHandler;
|
||||
if (PySdkUtil.isRemote(sdk)) {
|
||||
processHandler = startRemoteProcess(sdk, commandLine);
|
||||
assert sdk != null;
|
||||
processHandler =
|
||||
createRemoteProcessStarter().startRemoteProcess(sdk, commandLine, myConfig.getProject(), myConfig.getMappingSettings());
|
||||
}
|
||||
else {
|
||||
processHandler = doCreateProcess(commandLine);
|
||||
@@ -177,38 +179,10 @@ public abstract class PythonCommandLineState extends CommandLineState {
|
||||
return processHandler;
|
||||
}
|
||||
|
||||
private ProcessHandler startRemoteProcess(Sdk sdk, GeneralCommandLine commandLine) throws ExecutionException {
|
||||
PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
|
||||
if (manager != null) {
|
||||
ProcessHandler processHandler =
|
||||
null;
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
processHandler = doStartRemoteProcess(sdk, commandLine, manager);
|
||||
break;
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
if (Messages.showYesNoDialog(e.getMessage() + "\nTry again?", "Can't Run Remote Interpreter", Messages.getErrorIcon()) ==
|
||||
Messages.NO) {
|
||||
throw new ExecutionException("Can't run remote python interpreter: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
ProcessTerminatedListener.attach(processHandler);
|
||||
return processHandler;
|
||||
}
|
||||
else {
|
||||
throw new PythonRemoteInterpreterManager.PyRemoteInterpreterExecutionException();
|
||||
}
|
||||
protected PyRemoteProcessStarter createRemoteProcessStarter() {
|
||||
return new PyRemoteProcessStarter();
|
||||
}
|
||||
|
||||
protected ProcessHandler doStartRemoteProcess(Sdk sdk, GeneralCommandLine commandLine, PythonRemoteInterpreterManager manager)
|
||||
throws ExecutionException {
|
||||
|
||||
return manager.startRemoteProcess(myConfig.getProject(), (PyRemoteSdkAdditionalData)sdk.getSdkAdditionalData(), commandLine,
|
||||
myConfig.getMappingSettings());
|
||||
}
|
||||
|
||||
public GeneralCommandLine generateCommandLine(CommandLinePatcher[] patchers) throws ExecutionException {
|
||||
GeneralCommandLine commandLine = generateCommandLine();
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.NotNullFunction;
|
||||
import com.jetbrains.django.util.OSUtil;
|
||||
import com.jetbrains.python.buildout.BuildoutFacet;
|
||||
import com.jetbrains.python.sdk.PySdkUtil;
|
||||
import com.jetbrains.python.sdk.PythonEnvUtil;
|
||||
import com.jetbrains.python.sdk.PythonSdkType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -82,9 +83,16 @@ public class PythonTask {
|
||||
public ProcessHandler createProcess() throws ExecutionException {
|
||||
GeneralCommandLine commandLine = createCommandLine();
|
||||
|
||||
ProcessHandler handler = PythonProcessRunner.createProcessHandlingCtrlC(commandLine);
|
||||
ProcessHandler handler;
|
||||
if (PySdkUtil.isRemote(mySdk)) {
|
||||
assert mySdk != null;
|
||||
handler = new PyRemoteProcessStarter().startRemoteProcess(mySdk, commandLine, myModule.getProject(), null);
|
||||
}
|
||||
else {
|
||||
handler = PythonProcessRunner.createProcessHandlingCtrlC(commandLine);
|
||||
|
||||
ProcessTerminatedListener.attach(handler);
|
||||
ProcessTerminatedListener.attach(handler);
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
@@ -106,7 +114,7 @@ public class PythonTask {
|
||||
assert scriptParams != null;
|
||||
cmd.setPassParentEnvs(true);
|
||||
Map<String, String> envs = new HashMap<String, String>();
|
||||
if (!SystemInfo.isWindows) {
|
||||
if (!SystemInfo.isWindows && !PySdkUtil.isRemote(mySdk)) {
|
||||
cmd.setExePath("bash");
|
||||
ParamsGroup bashParams = cmd.getParametersList().addParamsGroupAt(0, "Bash");
|
||||
bashParams.addParameter("-cl");
|
||||
|
||||
Reference in New Issue
Block a user