conda-forge / pyside2-feedstock

A conda-smithy repository for pyside2.
BSD 3-Clause "New" or "Revised" License
17 stars 19 forks source link

Fix pyside2uic.UIParser on Python 3.9 #105

Closed n-elie closed 2 years ago

n-elie commented 2 years ago

Patch UIParser.readResources to make it works with Python 3.9. Without this patch, we get this error:

Traceback (most recent call last): File "simple.py", line 12, in MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE) File "\Miniconda3\envs\pysideads\lib\site-packages\qtpy\uic.py", line 271, in loadUiType compileUi(fd, code_stream, indent=0, from_imports=from_imports) File "\Miniconda3\envs\pysideads\lib\site-packages\pyside2uic__init__.py", line 144, in compileUi winfo = ui_comp.compileUi(uifile, pyfile, from_imports) File "\Miniconda3\envs\pysideads\lib\site-packages\pyside2uic\Compiler\compiler.py", line 91, in compileUi w = self.parse(input_stream) File "\Miniconda3\envs\pysideads\lib\site-packages\pyside2uic\uiparser.py", line 882, in parse actor(elem) File "\Miniconda3\envs\pysideads\lib\site-packages\qtpy\uic.py", line 253, in readResources elem.getiterator = elem.iter AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

Methods getchildren() and getiterator() of classes ElementTree and Element in the ElementTree module have been removed. They were deprecated in Python 3.2. Use iter(x) or list(x) instead of x.getchildren() and x.iter() or list(x.iter()) instead of x.getiterator(). (Contributed by Serhiy Storchaka in bpo-36543.)

https://docs.python.org/3.9/whatsnew/3.9.html#removed

Checklist

conda-forge-linter commented 2 years ago

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

n-elie commented 2 years ago

This patch is also needed for 'pyside2-uic' command to work properly. Without it, the following error occurs and import needed for resources loading and custom widgets are not written at the end of the file:


Check that you are using the latest version of PySide2 and report the error to
http://bugs.openbossa.org, including the ui file used to trigger the error.```
n-elie commented 2 years ago

@conda-forge-admin, please rerender

n-elie commented 2 years ago

Ready for review. This PR also fixes build on Windows by relocating libpyside build to sources/PySide2 (See #99). Not sure why it is needed And it fixes a problem with QToolButton.setMenu which was not keeping a reference of the menu.

n-elie commented 2 years ago

Hello,

Is there something wrong with this PR? I personally need pyside-uic to work properly.

Regards

jan-janssen commented 2 years ago

Hello,

Is there something wrong with this PR? I personally need pyside-uic to work properly.

Regards

It failed on Mac OS X

jan-janssen commented 2 years ago

@conda-forge-admin, please rerender

n-elie commented 2 years ago

It was working well before I rerendered

jan-janssen commented 2 years ago

@conda-forge-admin, please restart ci

n-elie commented 2 years ago

This time all checks have passed

n-elie commented 2 years ago

Thanks for your help

hmaarrfk commented 2 years ago

did this really fix anything? it seems like things are still broken.

n-elie commented 2 years ago

What is still broken exactly?

hmaarrfk commented 2 years ago

Sorry, i think i had an other conflict in one of my packages and the conda solver seemed to point me around in circles. Eventually, I was able to plug in the libmamba solver, but it wasn't as straightforward as I would have liked.

Thank you for your response.