This repository was archived by the owner on Nov 2, 2020. It is now read-only.
File tree 7 files changed +20
-7
lines changed
7 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 74
74
and in Windows this could be like: C:\\Python27\\python.exe
75
75
*/
76
76
77
- "path_to_python3 " : " /usr/bin/python" ,
77
+ "path_to_python " : " /usr/bin/python" ,
78
78
79
79
/*
80
80
Module search path defines a list of paths where the
Original file line number Diff line number Diff line change @@ -161,8 +161,5 @@ def rf_data(self, file_path):
161
161
return None
162
162
163
163
def is_string (self , str_ ):
164
- if version_info .major > 2 :
165
- status = isinstance (str_ , str )
166
- else :
167
- raise RuntimeError ('Plugin only works with python 3' )
168
- return status
164
+ return isinstance (str_ , str )
165
+
Original file line number Diff line number Diff line change
1
+ import subprocess
1
2
from .command_logging import LogCommands
2
3
from .index_open_tab import IndexOpenTabCommand
3
4
from .jump_to_keyword import JumpToKeyword
11
12
from .setting_import_helper import InsertImport
12
13
from .setting_import_helper import SettingImporter
13
14
from .show_documentation import ShowKeywordDocumentation
15
+ from sublime import error_message
14
16
15
17
__all__ = [
16
18
'IndexOpenTabCommand' ,
27
29
'SettingImporter' ,
28
30
'ShowKeywordDocumentation'
29
31
]
32
+
33
+ def check_binary_version (python_binary ):
34
+ result = subprocess .check_output ([python_binary ,"-c" , "import sys;print(sys.version_info.major)" ])
35
+ version = int (result .decode ('utf-8' ).strip ())
36
+ if version < 3 :
37
+ error_message ('RobotFrameworkAssistant\n ' +
38
+ '***********************************\n ' +
39
+ 'Plugin fully support on python 3\n ' )
Original file line number Diff line number Diff line change 3
3
import subprocess
4
4
from platform import system
5
5
from os import path , makedirs
6
+ from . import check_binary_version
6
7
from ..setting .setting import get_setting
7
8
from ..setting .setting import SettingObject
8
9
@@ -34,6 +35,7 @@ def run(self, edit):
34
35
Also all imports, from found files, will be iterated and
35
36
table is created also from imports.
36
37
"""
38
+ check_binary_version (get_setting (SettingObject .python_binary ))
37
39
log_file = get_setting (SettingObject .log_file )
38
40
makedirs (path .dirname (log_file ), exist_ok = True )
39
41
file_ = open (log_file , 'a' )
Original file line number Diff line number Diff line change 5
5
from os import path , makedirs
6
6
from hashlib import md5
7
7
import json
8
+ from . import check_binary_version
8
9
from ..setting .setting import get_setting
9
10
from ..setting .setting import SettingObject
10
11
from ..setting .db_json_settings import DBJsonSetting
@@ -45,6 +46,7 @@ def add_builtin_vars(db_path):
45
46
class ScanIndexCommand (sublime_plugin .TextCommand ):
46
47
47
48
def run (self , edit ):
49
+ check_binary_version (get_setting (SettingObject .python_binary ))
48
50
log_file = get_setting (SettingObject .log_file )
49
51
db_dir = get_setting (SettingObject .table_dir )
50
52
makedirs (path .dirname (log_file ), exist_ok = True )
Original file line number Diff line number Diff line change 3
3
import subprocess
4
4
from platform import system
5
5
from os import path , makedirs
6
+ from . import check_binary_version
6
7
from ..setting .setting import get_setting
7
8
from ..setting .setting import SettingObject
8
9
from .scan import scan_popen_arg_parser
@@ -16,6 +17,7 @@ def run(self, edit):
16
17
Purpose of the command is scan and create the db table
17
18
from the currently open tab.
18
19
"""
20
+ check_binary_version (get_setting (SettingObject .python_binary ))
19
21
log_file = get_setting (SettingObject .log_file )
20
22
makedirs (path .dirname (log_file ), exist_ok = True )
21
23
open_tab = self .view .file_name ()
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class SettingObject(object):
51
51
scanner_runner = 'scanner_runner'
52
52
index_runner = 'index_runner'
53
53
log_file = 'log_file'
54
- python_binary = 'path_to_python3 '
54
+ python_binary = 'path_to_python '
55
55
workspace = 'robot_framework_workspace'
56
56
extension = 'robot_framework_extension'
57
57
builtin_variables = 'robot_framework_builtin_variables'
You can’t perform that action at this time.
0 commit comments