mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-27650 Check build numbers for warnings
This commit is contained in:
@@ -83,6 +83,7 @@ from _pydevd_bundle import pydevd_xml
|
||||
from _pydevd_bundle import pydevd_tracing
|
||||
from _pydevd_bundle import pydevd_vm_type
|
||||
from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, norm_file_to_client
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
from _pydevd_bundle.pydevd_utils import quote_smart as quote, compare_object_attrs_key, to_string
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
|
||||
# make settrace() function available for `pydevd_pycharm`
|
||||
from pydevd import settrace
|
||||
from pydevd import settrace
|
||||
|
||||
from _pydevd_bundle.pydevd_comm import VERSION_STRING
|
||||
__version__ = VERSION_STRING
|
||||
|
||||
@@ -65,18 +65,22 @@ git push --tags
|
||||
'''
|
||||
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools.dist import Distribution
|
||||
from distutils.extension import Extension
|
||||
import os
|
||||
import sys
|
||||
from distutils.extension import Extension
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools.dist import Distribution
|
||||
|
||||
|
||||
class BinaryDistribution(Distribution):
|
||||
def is_pure(self):
|
||||
return False
|
||||
|
||||
|
||||
data_files = []
|
||||
|
||||
|
||||
def accept_file(f):
|
||||
f = f.lower()
|
||||
for ext in '.py .dll .so .dylib .txt .cpp .h .bat .c .sh .md .txt'.split():
|
||||
@@ -110,12 +114,29 @@ add_extensions_to_datafiles(data_files, '_pydevd_bundle')
|
||||
add_extensions_to_datafiles(data_files, '_pydevd_frame_eval')
|
||||
|
||||
|
||||
def get_version_from_file():
|
||||
def _get_version_from_file():
|
||||
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'VERSION')) as version_file:
|
||||
version = version_file.read().strip()
|
||||
return version
|
||||
version_str = version_file.read().strip()
|
||||
return version_str
|
||||
|
||||
|
||||
def _replace_version_placeholder_in_file(filepath, version_str, version_placeholder="@@BUILD_NUMBER@@"):
|
||||
with open(filepath, 'r') as file:
|
||||
file_text = file.read()
|
||||
result = file_text.replace(version_placeholder, version_str)
|
||||
with open(filepath, 'w') as file:
|
||||
file.write(result)
|
||||
|
||||
|
||||
def _replace_version_placeholder(version_str):
|
||||
pydevd_filepath = os.path.dirname(os.path.abspath(__file__))
|
||||
pydevd_comm_filepath = os.path.join(os.path.join(pydevd_filepath, '_pydevd_bundle'), 'pydevd_comm.py')
|
||||
_replace_version_placeholder_in_file(pydevd_comm_filepath, version_str)
|
||||
|
||||
|
||||
version = _get_version_from_file()
|
||||
_replace_version_placeholder(version)
|
||||
|
||||
version = get_version_from_file()
|
||||
|
||||
args = dict(
|
||||
name='pydevd-pycharm',
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -414,18 +415,14 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
if ("@@BUILD_NUMBER@@".equals(remoteVersion)) {
|
||||
remoteVersion = currentBuild;
|
||||
}
|
||||
else if (remoteVersion.startsWith("PY-")) {
|
||||
remoteVersion = remoteVersion.substring(3);
|
||||
}
|
||||
else {
|
||||
remoteVersion = null;
|
||||
}
|
||||
else remoteVersion = StringUtil.trimStart(remoteVersion, "PY-");
|
||||
printToConsole("Connected to pydev debugger (build " + remoteVersion + ")\n", ConsoleViewContentType.SYSTEM_OUTPUT);
|
||||
|
||||
if (remoteVersion != null) {
|
||||
if (!(remoteVersion.equals(currentBuild) || remoteVersion.startsWith(currentBuild))) {
|
||||
LOG.warn(String.format("Wrong debugger version. Remote version: %s Current build: %s", remoteVersion, currentBuild));
|
||||
printToConsole("Warning: wrong debugger version. Use pycharm-debugger.egg from PyCharm installation folder.\n",
|
||||
printToConsole(String.format("Warning: wrong debugger version. Use pycharm-debugger.egg from PyCharm installation folder\n" +
|
||||
"Or execute: 'pip install pydevd-pycharm~=%s'\n", currentBuild),
|
||||
ConsoleViewContentType.ERROR_OUTPUT);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user