Skip to content

Commit

Permalink
Uses a new method to determine version, Unit tests broken
Browse files Browse the repository at this point in the history
  • Loading branch information
HelioGuilherme66 committed Oct 6, 2024
1 parent d5b46a5 commit e921d74
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 24 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.12) Install current development version (**2.1dev85**) with:
(3.8 <= python <= 3.12) Install current development version (**2.1dev86**) with:

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

Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
setuptools>=70.0.0
mockito
invoke
requests>=2.32.2 # not directly required, pinned by Snyk to avoid a vulnerability
urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability
zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability
github3.py
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ robotframework
Pypubsub
psutil
packaging
requests>=2.32.2
2 changes: 1 addition & 1 deletion src/robotide/application/releasenotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,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 04/October/2024.</p>
<p>RIDE {VERSION} was released on 07/October/2024.</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
34 changes: 14 additions & 20 deletions src/robotide/application/updatenotifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import xmlrpc.client as xmlrpclib
from dataclasses import dataclass

import psutil
import requests
import wx
from wx import Colour

Expand Down Expand Up @@ -72,8 +72,9 @@ def _should_check(self):
def _is_new_version_available(self):
self._settings[_LAST_UPDATE_CHECK_SETTING] = time.time()
try:
self._get_rf_pypi_data()
self._newest_version = self._get_newest_version()
self._download_url = self._get_download_url(self._newest_version)
self._download_url = self._get_download_url()
except Exception as e:
print(e)
# There are many possible errors:
Expand All @@ -85,20 +86,17 @@ def _is_new_version_available(self):
return cmp_versions(self.VERSION, self._newest_version) == -1

def _get_newest_version(self):
return self._get_response(('robotframework-ride',), 'package_releases')[0]
return self.pyver

def _get_download_url(self, dversion):
from time import sleep
sleep(1) # To avoid HTTPTooManyRequests
return self._get_response(('robotframework-ride', dversion), 'release_data')['download_url']
def _get_download_url(self):
return self.pyurl

@staticmethod
def _get_response(params, method):
xmlparm = xmlrpclib.dumps(params, method)
req = urllib2.Request('https://pypi.python.org/pypi', xmlparm.encode('utf-8'), {'Content-Type': 'text/xml'})
data = urllib2.urlopen(req, timeout=1).read()
xml = xmlrpclib.loads(data)[0][0]
return xml
def _get_rf_pypi_data(self):
resp = requests.get("https://pypi.org/simple/robotframework-ride/",
headers={"Accept": "application/vnd.pypi.simple.v1+json"})
pydata = resp.json()
self.pyver = pydata['versions'][-1]
self.pyurl = pydata['files'][-1]['url']


def upgrade_from_dev_dialog(version_installed, notebook, show_no_update=False):
Expand Down Expand Up @@ -151,7 +149,7 @@ def _add_content_to_clipboard(content):


@dataclass
class Command:
class RunnerCommand:
def __init__(self, name, command, documentation):
self.name = name
self.command = command
Expand All @@ -162,12 +160,8 @@ def do_upgrade(command, notebook):
_add_content_to_clipboard(command)
# print("DEBUG: Here will be the installation step.") # DEBUG 'pip list'
from ..run import ui
config = Command('Upgrade RIDE', command, 'Uses pip to upgrade RIDE.')
config = RunnerCommand('Upgrade RIDE', command, 'Uses pip to upgrade RIDE.')
result = ui.Runner(config, notebook).run()

# result = _askyesno(_("Completed Upgrade"), f"\n{SPC}{_('You should close this RIDE (Process ID = ')}{result}){SPC}",
# wx.GetActiveWindow())

print(f"DEBUG: do_upgrade result={result}")
result = 0
time.sleep(10)
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.1dev85'
VERSION = 'v2.1dev86'

0 comments on commit e921d74

Please sign in to comment.