diff --git a/python/build/python_plugin_build.gant b/python/build/python_plugin_build.gant index a364483f6720..2b9eb23cefee 100644 --- a/python/build/python_plugin_build.gant +++ b/python/build/python_plugin_build.gant @@ -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") diff --git a/python/helpers/pycharm/fix_getpass.py b/python/helpers/pycharm/fix_getpass.py index 1ef209c3384e..c81d93523238 100644 --- a/python/helpers/pycharm/fix_getpass.py +++ b/python/helpers/pycharm/fix_getpass.py @@ -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) + diff --git a/python/helpers/pydev/fix_getpass.py b/python/helpers/pydev/fix_getpass.py new file mode 100644 index 000000000000..c81d93523238 --- /dev/null +++ b/python/helpers/pydev/fix_getpass.py @@ -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) + diff --git a/python/helpers/pydev/pydevconsole.py b/python/helpers/pydev/pydevconsole.py index 1f75c21fd2f2..6b2688162948 100644 --- a/python/helpers/pydev/pydevconsole.py +++ b/python/helpers/pydev/pydevconsole.py @@ -14,6 +14,8 @@ else: import threading import traceback +import fix_getpass +fix_getpass.fixGetpass() try: if USE_LIB_COPY: diff --git a/python/helpers/pydev/pydevd.py b/python/helpers/pydev/pydevd.py index 8d68e503c7cb..b75d388bc80b 100644 --- a/python/helpers/pydev/pydevd.py +++ b/python/helpers/pydev/pydevd.py @@ -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)) diff --git a/python/helpers/pydev/pydevd_additional_thread_info.py b/python/helpers/pydev/pydevd_additional_thread_info.py index e44eeac81bab..d2d3fffbce82 100644 --- a/python/helpers/pydev/pydevd_additional_thread_info.py +++ b/python/helpers/pydev/pydevd_additional_thread_info.py @@ -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") diff --git a/python/helpers/pydev/pydevd_resolver.py b/python/helpers/pydev/pydevd_resolver.py index 2ced2c95a4c0..114b8494b654 100644 --- a/python/helpers/pydev/pydevd_resolver.py +++ b/python/helpers/pydev/pydevd_resolver.py @@ -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 diff --git a/python/psi-api/src/com/jetbrains/python/psi/PyStubElementType.java b/python/psi-api/src/com/jetbrains/python/psi/PyStubElementType.java index 63aa84ac338a..7ac7547e2c47 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/PyStubElementType.java +++ b/python/psi-api/src/com/jetbrains/python/psi/PyStubElementType.java @@ -24,9 +24,10 @@ public abstract class PyStubElementType fillToolBarActions(final DefaultActionGroup toolbarActions, final Executor defaultExecutor, @@ -378,9 +379,6 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory { 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 all = readNullableList(dataStream); BitSet future_features = readBitSet(dataStream); StringRef deprecationMessage = dataStream.readName(); diff --git a/python/src/com/jetbrains/python/psi/impl/stubs/PyAnnotationElementType.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyAnnotationElementType.java index 7512acd3befd..daa5038f2f45 100644 --- a/python/src/com/jetbrains/python/psi/impl/stubs/PyAnnotationElementType.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyAnnotationElementType.java @@ -38,11 +38,12 @@ public class PyAnnotationElementType extends PyStubElementType 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 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 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); diff --git a/python/src/com/jetbrains/python/psi/impl/stubs/PyDecoratorCallElementType.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyDecoratorCallElementType.java index 9eff8fae4d23..1d78a798d5aa 100644 --- a/python/src/com/jetbrains/python/psi/impl/stubs/PyDecoratorCallElementType.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyDecoratorCallElementType.java @@ -36,11 +36,12 @@ public class PyDecoratorCallElementType extends PyStubElementType 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); diff --git a/python/src/com/jetbrains/python/psi/impl/stubs/PyImportElementElementType.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyImportElementElementType.java index 3cbc48b5fa9b..e2d6dad14c8e 100644 --- a/python/src/com/jetbrains/python/psi/impl/stubs/PyImportElementElementType.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyImportElementElementType.java @@ -46,12 +46,13 @@ public class PyImportElementElementType extends PyStubElementType envs = new HashMap(); - if (!SystemInfo.isWindows) { + if (!SystemInfo.isWindows && !PySdkUtil.isRemote(mySdk)) { cmd.setExePath("bash"); ParamsGroup bashParams = cmd.getParametersList().addParamsGroupAt(0, "Bash"); bashParams.addParameter("-cl");