Skip to content

Commit af0287a

Browse files
Make RIDE working without Robot Framework or version older than 6.0
1 parent 5a27c39 commit af0287a

File tree

12 files changed

+68
-16
lines changed

12 files changed

+68
-16
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni
1515
when selecting in Tree shows the filename in StatusBar.
1616

1717
=== Changed
18+
- Modified import statements to allow running RIDE without Robot Framework installed or versions older than 6.0.
1819
- On Windows ignore false modification on files when opening Test Suites, causing confirmation dialog.
1920

2021
== https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.1.3.rst[2.1.3] - 2025-03-24

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Likewise, the current version of wxPython, is 4.2.2, but RIDE is known to work w
4040

4141
`pip install -U robotframework-ride`
4242

43-
(3.8 <= python <= 3.13) Install current development version (**2.2dev17**) with:
43+
(3.8 <= python <= 3.13) Install current development version (**2.2dev18**) with:
4444

4545
`pip install -U https://github.com/robotframework/RIDE/archive/develop.zip`
4646

src/robotide/application/CHANGELOG.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
Added divided Status Bar. Left side for main window, right side for Plugins. Working example in Text Editor,
99
when selecting in Tree shows the filename in StatusBar.
1010
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_changed"></a>1.2. Changed</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
11+
Modified import statements to allow running RIDE without Robot Framework installed or versions older than 6.0.
12+
</li><li class="listitem">
1113
On Windows ignore false modification on files when opening Test Suites, causing confirmation dialog.
1214
</li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_ulink_url_https_github_com_robotframework_ride_blob_master_doc_releasenotes_ride_2_1_3_rst_2_1_3_ulink_2025_03_24"></a>2. <a class="ulink" href="https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.1.3.rst" target="_top">2.1.3</a> - 2025-03-24</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_added_2"></a>2.1. Added</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1315
Added syntax colorization for the ``GROUP`` marker.

src/robotide/application/releasenotes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def set_content(self, html_win, content):
170170
</ul>
171171
<p><strong>New Features and Fixes Highlights</strong></p>
172172
<ul class="simple">
173+
<li>Modified import statements to allow running RIDE without Robot Framework installed or versions older than 6.0.</li>
173174
<li>Added Config Panel button to supported installed Plugins next to their name in Plugin Manager dialog.</li>
174175
<li>Added Config Panel button to Plugins, working example in Text Editor.</li>
175176
<li>On Windows ignore false modification on files when opening Test Suites, causing confirmation dialog.</li>
@@ -229,7 +230,7 @@ def set_content(self, html_win, content):
229230
<pre class="literal-block">python -m robotide.postinstall -install</pre>
230231
<p>or</p>
231232
<pre class="literal-block">ride_postinstall.py -install</pre>
232-
<p>RIDE {VERSION} was released on 30/March/2025.</p>
233+
<p>RIDE {VERSION} was released on 02/April/2025.</p>
233234
<!-- <br/>
234235
<h3>May The Fourth Be With You!</h3>
235236
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>

src/robotide/editor/texteditor.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -718,13 +718,13 @@ def set_editor(self, editor):
718718
self._editor = editor
719719

720720

721-
def validate_and_update(self, data, text):
721+
def validate_and_update(self, data, text, lang='en'):
722722

723723
try:
724724
from robot.parsing.parser.parser import get_model # RF > 4.0
725725
except ImportError:
726726
return self._old_validate_and_update(data, text)
727-
return self._new_validate_and_update(data, text)
727+
return self._new_validate_and_update(data, text, lang)
728728

729729
"""
730730
Backwards compatible code v1.7.4.2
@@ -746,12 +746,13 @@ def _old_validate_and_update(self, data, text):
746746

747747
def _old_sanity_check(self, data, text):
748748
formatted_text = data.format_text(text)
749+
# print(f"DEBUG: texteditor old_sanity_check {formatted_text=}")
749750
c = self._normalize(formatted_text)
750751
e = self._normalize(text)
751752
return len(c) == len(e)
752753

753754
@staticmethod
754-
def _normalize(self, text):
755+
def _normalize(text):
755756
for item in [' ', r'\t', r'\n', r'\r\n', '...', '*']:
756757
if item in text:
757758
# print("DEBUG: _normaliz item %s txt %s" % (item, text))

src/robotide/lib/compat/parsing/language.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
try:
2323
# Using local copy of https://github.com/robotframework/robotframework/blob/v7.0.1/src/robot/conf/languages.py
2424
from .languages import Language
25-
except ImportError:
25+
except ImportError as e:
26+
sys.stderr.write(f"RIDE: Trying to import robot's languages module returned error: {repr(e)}\n")
2627
Language = None
2728
from robot.errors import DataError
2829
from robotide.lib.robot.utils import Utf8Reader
@@ -236,11 +237,12 @@ def get_english_label(lang, label):
236237
try:
237238
mlang = Language.from_name(lang[0].replace('_', '-')) # Only care for a single language
238239
except ValueError:
239-
print(f"DEBUG: language.py get_english_label Exception at language={lang}")
240+
# print(f"DEBUG: language.py get_english_label Exception at language={lang}")
241+
pass
240242
else:
241243
mlang = Language.from_name(lang.replace('_', '-'))
242244
if not mlang:
243-
print(f"DEBUG: language.py get_english_label lang={lang} not found")
245+
# print(f"DEBUG: language.py get_english_label lang={lang} not found")
244246
return None
245247
setting_names = list(mlang.settings.keys())
246248
try:

src/robotide/lib/compat/parsing/languages.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,36 @@
2020
from typing import cast, Iterable, Iterator, Union
2121

2222
from robot.errors import DataError
23-
from robot.utils import classproperty, is_list_like, Importer, normalize
23+
from robot.utils import is_list_like, Importer, normalize
24+
try:
25+
from robot.utils import classproperty
26+
except ImportError: # This is when using RF older than 6.0
27+
28+
class classproperty(property):
29+
"""Property that works with classes in addition to instances.
30+
31+
Only supports getters. Setters and deleters cannot work with classes due
32+
to how the descriptor protocol works, and they are thus explicitly disabled.
33+
Metaclasses must be used if they are needed.
34+
"""
35+
36+
def __init__(self, fget, fset=None, fdel=None, doc=None):
37+
if fset:
38+
self.setter(fset)
39+
if fdel:
40+
self.deleter(fset)
41+
super().__init__(fget)
42+
if doc:
43+
self.__doc__ = doc
44+
45+
def __get__(self, instance, owner):
46+
return self.fget(owner)
47+
48+
def setter(self, fset):
49+
raise TypeError('Setters are not supported.')
50+
51+
def deleter(self, fset):
52+
raise TypeError('Deleters are not supported.')
2453

2554

2655
LanguageLike = Union['Language', str, Path]

src/robotide/lib/robot/parsing/model.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,10 @@ def __iter__(self):
473473
for table in self.tables:
474474
yield table
475475

476-
477-
from robotide.lib.compat.parsing.language import get_headers_for
476+
try:
477+
from robotide.lib.compat.parsing.language import get_headers_for
478+
except ImportError:
479+
get_headers_for = lambda l, t, lowercase=False: t
478480

479481

480482
class _Table(object):

src/robotide/lib/robot/parsing/settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515

1616
from multiprocessing import shared_memory
1717
from robotide.lib.robot.utils import is_string, unicode
18-
from robotide.lib.compat.parsing.language import get_localized_setting
18+
try:
19+
from robotide.lib.compat.parsing.language import get_localized_setting
20+
except ImportError:
21+
get_localized_setting = lambda l, item: item
1922

2023
from .comments import Comment
2124
from ..version import ALIAS_MARKER

src/robotide/lib/robot/writer/formatters.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import re
1717

1818
from multiprocessing import shared_memory
19-
from robotide.lib.compat.parsing.language import get_headers_for
2019
from .aligners import FirstColumnAligner, ColumnAligner, NullAligner
2120
from .dataextractor import DataExtractor
2221
from .rowsplitter import RowSplitter
@@ -123,7 +122,13 @@ def _pad(self, row):
123122

124123

125124
def translate_header(header: str, language=None) -> str:
126-
if not language:
125+
can_translate = True
126+
try:
127+
from robotide.lib.compat.parsing.language import get_headers_for
128+
except ImportError:
129+
get_headers_for = lambda l, t, lowercase=False: t
130+
can_translate = False
131+
if not language or not can_translate:
127132
return header
128133
tr_header = list(get_headers_for(language, header, lowercase=False))
129134
if len(tr_header) > 1:

0 commit comments

Comments
 (0)