Skip to content

Commit

Permalink
Improve restoring of preferences/configobj when upgrade from development
Browse files Browse the repository at this point in the history
  • Loading branch information
HelioGuilherme66 committed Feb 13, 2025
1 parent 4a93663 commit 85192a4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Likewise, the current version of wxPython, is 4.2.2, but RIDE is known to work w

`pip install -U robotframework-ride`

(3.8 <= python <= 3.13) Install current development version (**2.2dev4**) with:
(3.8 <= python <= 3.13) Install current development version (**2.2dev5**) with:

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

Expand Down
2 changes: 1 addition & 1 deletion src/robotide/application/releasenotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def set_content(self, html_win, content):
<pre class="literal-block">python -m robotide.postinstall -install</pre>
<p>or</p>
<pre class="literal-block">ride_postinstall.py -install</pre>
<p>RIDE {VERSION} was released on 12/February/2025.</p>
<p>RIDE {VERSION} was released on 13/February/2025.</p>
<!-- <br/>
<h3>May The Fourth Be With You!</h3>
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>
Expand Down
32 changes: 20 additions & 12 deletions src/robotide/application/updatenotifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,7 @@ def upgrade_from_dev_dialog(version_installed, notebook, show_no_update=False):
f"{SPC}\n", wx.GetActiveWindow(), no_default=True):
return False
else:
import zipfile
backup_configobj = tempfile.NamedTemporaryFile(delete=False)
config_obj_dir = path.join(path.dirname(__file__), '../preferences/configobj')
files = os.listdir(config_obj_dir)
with zipfile.ZipFile(backup_configobj.name, 'w') as zzip:
for file in files:
file_path = os.path.join(config_obj_dir, file)
zzip.write(file_path)
do_upgrade(command, notebook)
with zipfile.ZipFile(backup_configobj.name, 'r') as zzip:
zzip.extractall(config_obj_dir)
print(f"DEBUG: updatentivier, {config_obj_dir=} {backup_configobj.name}")
os.remove(backup_configobj.name)
return True
else:
if show_no_update:
Expand Down Expand Up @@ -188,6 +176,26 @@ def do_upgrade(command, notebook):

def start_upgraded(message):
__ = message
import zipfile
import requests

def download_url(url, save_path, chunk_size=128):
r = requests.get(url, stream=True)
with open(save_path, 'wb') as fd:
for chunk in r.iter_content(chunk_size=chunk_size):
fd.write(chunk)

backup_configobj = tempfile.NamedTemporaryFile(delete=False)
config_obj_dir = path.join(path.dirname(__file__), '../preferences')
# print(f"DEBUG: updatenotifier, Starting do_upgrade {config_obj_dir=} zip is {backup_configobj.name=}")
download_url('https://robotframework.transformidea.com/RIDE/packages/configobj.zip', backup_configobj.name)
with zipfile.ZipFile(backup_configobj, 'r') as zzip:
zzip.extractall(config_obj_dir)
# print(f"DEBUG: updatenotifier, {config_obj_dir=} extracted {backup_configobj.name}")
try:
os.remove(backup_configobj.name)
except PermissionError:
pass
command = sys.executable + " -m robotide.__init__ --noupdatecheck"
wx.CallLater(1000, subprocess.Popen, command.split(' '), start_new_session=True)
p = psutil.Process()
Expand Down
2 changes: 1 addition & 1 deletion src/robotide/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
#
# Automatically generated by `tasks.py`.

VERSION = 'v2.2dev4'
VERSION = 'v2.2dev5'

0 comments on commit 85192a4

Please sign in to comment.