Skip to content

Commit 85192a4

Browse files
Improve restoring of preferences/configobj when upgrade from development
1 parent 4a93663 commit 85192a4

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

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.2dev4**) with:
43+
(3.8 <= python <= 3.13) Install current development version (**2.2dev5**) with:
4444

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

src/robotide/application/releasenotes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def set_content(self, html_win, content):
225225
<pre class="literal-block">python -m robotide.postinstall -install</pre>
226226
<p>or</p>
227227
<pre class="literal-block">ride_postinstall.py -install</pre>
228-
<p>RIDE {VERSION} was released on 12/February/2025.</p>
228+
<p>RIDE {VERSION} was released on 13/February/2025.</p>
229229
<!-- <br/>
230230
<h3>May The Fourth Be With You!</h3>
231231
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>

src/robotide/application/updatenotifier.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,7 @@ def upgrade_from_dev_dialog(version_installed, notebook, show_no_update=False):
119119
f"{SPC}\n", wx.GetActiveWindow(), no_default=True):
120120
return False
121121
else:
122-
import zipfile
123-
backup_configobj = tempfile.NamedTemporaryFile(delete=False)
124-
config_obj_dir = path.join(path.dirname(__file__), '../preferences/configobj')
125-
files = os.listdir(config_obj_dir)
126-
with zipfile.ZipFile(backup_configobj.name, 'w') as zzip:
127-
for file in files:
128-
file_path = os.path.join(config_obj_dir, file)
129-
zzip.write(file_path)
130122
do_upgrade(command, notebook)
131-
with zipfile.ZipFile(backup_configobj.name, 'r') as zzip:
132-
zzip.extractall(config_obj_dir)
133-
print(f"DEBUG: updatentivier, {config_obj_dir=} {backup_configobj.name}")
134-
os.remove(backup_configobj.name)
135123
return True
136124
else:
137125
if show_no_update:
@@ -188,6 +176,26 @@ def do_upgrade(command, notebook):
188176

189177
def start_upgraded(message):
190178
__ = message
179+
import zipfile
180+
import requests
181+
182+
def download_url(url, save_path, chunk_size=128):
183+
r = requests.get(url, stream=True)
184+
with open(save_path, 'wb') as fd:
185+
for chunk in r.iter_content(chunk_size=chunk_size):
186+
fd.write(chunk)
187+
188+
backup_configobj = tempfile.NamedTemporaryFile(delete=False)
189+
config_obj_dir = path.join(path.dirname(__file__), '../preferences')
190+
# print(f"DEBUG: updatenotifier, Starting do_upgrade {config_obj_dir=} zip is {backup_configobj.name=}")
191+
download_url('https://robotframework.transformidea.com/RIDE/packages/configobj.zip', backup_configobj.name)
192+
with zipfile.ZipFile(backup_configobj, 'r') as zzip:
193+
zzip.extractall(config_obj_dir)
194+
# print(f"DEBUG: updatenotifier, {config_obj_dir=} extracted {backup_configobj.name}")
195+
try:
196+
os.remove(backup_configobj.name)
197+
except PermissionError:
198+
pass
191199
command = sys.executable + " -m robotide.__init__ --noupdatecheck"
192200
wx.CallLater(1000, subprocess.Popen, command.split(' '), start_new_session=True)
193201
p = psutil.Process()

src/robotide/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
#
1616
# Automatically generated by `tasks.py`.
1717

18-
VERSION = 'v2.2dev4'
18+
VERSION = 'v2.2dev5'

0 commit comments

Comments
 (0)