wxGUI/extensions: fix reinstall/uninstall multi-addon e.g. wx.metadata#2452
wxGUI/extensions: fix reinstall/uninstall multi-addon e.g. wx.metadata#2452tmszi wants to merge 6 commits intoOSGeo:mainfrom
Conversation
|
@tmszi would you mind to rebase this PR? |
Yes, I will do it as soon as I have more free time. Plus PR also needs to be improved. |
|
Also conflicts have to be solved. |
|
I have tried this in the current "main" (8.4) GUI and it worked: Maybe I didn't test correctly to trigger the bug? |
Important step is reinstalling/removing extension via wxGUI only (main window menu -> Settings -> Addons extensions - > Manage installed extension). But yes you are right it is seems reinstalling extensions works as expected, but removing extension still not. |
|
Is this now out of scope for 8.4.0? |
|
@tmszi would you mind to rebase this PR again? This would simplify testing and make it (hopefully) 8.4.0 ready. |
Yes I agree with you. I have had limited my free time last weeks. I think this PR will also require code refactoring. I will try to resolve this as quickly as possible. |
333b273 to
faac751
Compare
| from pathlib import Path | ||
| from urllib.parse import urlparse | ||
|
|
||
| import xml.etree.ElementTree as etree |
Check notice
Code scanning / Bandit
Using xml.etree.ElementTree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
| response_format="application/xml", | ||
| file_name=os.path.basename(urlparse(url).path), | ||
| ) | ||
| tree = etree.fromstring(response.read()) |
Check warning
Code scanning / Bandit
Using xml.etree.ElementTree.fromstring to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree.fromstring with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
| opener = urlrequest.build_opener(proxy) | ||
| urlrequest.install_opener(opener) | ||
| request = urlrequest.Request(url, headers=HEADERS) | ||
| return urlrequest.urlopen(request, *args, **kwargs) |
Check warning
Code scanning / Bandit
Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
|
Rebase was successful and tests passed successful too. |
|
For testing purpose:
|
| >>> addons = find_addon_name( | ||
| ... addons=[ | ||
| ... "g.gui.metadata", | ||
| ... "g.gui.cswbrowser", | ||
| ... "db.csw.run", | ||
| ... "db.csw.harvest", | ||
| ... "db.csw.admin", | ||
| ... "v.info.iso", | ||
| ... "r.info.iso", | ||
| ... "t.info.iso", | ||
| ... "db.join", | ||
| ... ] | ||
| ... ) | ||
| >>> addons.sort() | ||
| >>> addons | ||
| ['db.join', 'wx.metadata'] | ||
| """ |
There was a problem hiding this comment.
Not sure I understand this example result, why only those 2 addons?
There was a problem hiding this comment.
Not sure I understand this example result, why only those 2 addons?
wx.metadata is multi-addon (contains g.gui.metadata addon, g.gui.cswbrowser addon and etc.), we need identify multi-addon name which is in this example wx.metadata if user want uninstalling multi-addon (see GUI Manage installed extension dialog list of installed addon after you install some multi-addon e.g. wx.metadata)
Describe the bug
It is not possible reinstall multi-addon via wxGUI Manage installed GRASS Addons extensions.
To Reproduce
Steps to reproduce the behavior:
g.extension wx.metadataExpected behavior
Reinstall multi-addon via wxGUI Manage installed GRASS Addons extensions should be work.
System description (please complete the following information):
Additional context
The
g.extension.allmodule has an implemented find multi-addon name function.grass/scripts/g.extension.all/g.extension.all.py
Line 163 in 2dcc9d4