Skip to content

Commit

Permalink
2to3:
Browse files Browse the repository at this point in the history
* add fixes
* pyqt fixer: include some QtSql symbols and remove imports
  which only symbol was removed (eg. SIGNAL)
  • Loading branch information
jef-n committed Mar 21, 2016
1 parent d161612 commit d25c253
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/qgis_fixes/fix_pyqt.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,18 @@
"QSvgGenerator"
]),
],
"PyQt4.QtSql": [
("PyQt.QtSql", [
"QSqlDatabase",
"QSqlQuery",
"QSqlField"
]),
],
"PyQt4.uic": [
("PyQt.uic", [
"loadUiType",
]),
],
"PyQt4": [
("PyQt", [
"QtCore",
Expand Down Expand Up @@ -451,6 +463,8 @@ def transform_member(self, node, results):
mod_member.replace(Name(new_name, prefix=pref))
elif new_name == '':
self.cannot_convert(node, "This is an invalid module element")
else:
node.remove()

# Multiple members being imported
else:
Expand Down

1 comment on commit d25c253

@nirvn
Copy link
Contributor

@nirvn nirvn commented on d25c253 Mar 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jef-n testing this on my machine. I get an error in utils.py importing the configparser library:

ImportError: No module named 'ConfigParser'

Looking at python's documentation (here: https://docs.python.org/2/library/configparser.html), it mentions that the library was renamed from camel case to lowercase (i.e. from ConfigParser to configparser).

If I manually edit utils.py to modify the import to use lower case, it fixes that issue, but then I stumble on another error:

Traceback (most recent call last): File "", line 1, in File "/home/webmaster/dev/cpp/QGIS/bm-qt5/output/python/qgis/utils.py", line 577, in import __builtin__ ImportError: No module named '__builtin__'

Hope this is of help. Keep on the amazing work, and I'll keep trying to help out in the ways I can 😄

Please sign in to comment.