Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[plugin manager] fix broken QDirIterator next() call, make it pyqt5 5…
….7 compatible (#3517)
  • Loading branch information
nirvn authored and m-kuhn committed Sep 22, 2016
1 parent 56a23e9 commit e7c9400
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions python/pyplugin_installer/installer_data.py
Expand Up @@ -39,6 +39,10 @@
import configparser
except ImportError:
import configparser as configparser
try:
from importlib import reload
except ImportError:
from imp import reload
import qgis.utils
from qgis.core import Qgis, QgsNetworkAccessManager, QgsAuthManager, QgsWkbTypes
from qgis.gui import QgsMessageBar
Expand Down Expand Up @@ -134,13 +138,13 @@ def removeDir(path):
fltr = QDir.Dirs | QDir.Files | QDir.Hidden
iterator = QDirIterator(path, fltr, QDirIterator.Subdirectories)
while iterator.hasNext():
item = next(iterator)
item = iterator.next()
if QFile(item).remove():
pass
fltr = QDir.Dirs | QDir.Hidden
iterator = QDirIterator(path, fltr, QDirIterator.Subdirectories)
while iterator.hasNext():
item = next(iterator)
item = iterator.next()
if QDir().rmpath(item):
pass
if QFile(path).exists():
Expand Down Expand Up @@ -576,7 +580,7 @@ def metadataParser(fct):
global errorDetails
cp = configparser.ConfigParser()
try:
cp.readfp(codecs.open(metadataFile, "r", "utf8"))
cp.read_file(codecs.open(metadataFile, "r", "utf8"))
return cp.get('general', fct)
except Exception as e:
if not errorDetails:
Expand Down Expand Up @@ -713,7 +717,7 @@ def getAllInstalled(self, testLoad=True):
pluginDir.setFilter(QDir.AllDirs)
for key in pluginDir.entryList():
if key not in [".", ".."]:
path = QDir.convertSeparators(pluginsPath + "/" + key)
path = QDir.toNativeSeparators(pluginsPath + "/" + key)
# readOnly = not QFileInfo(pluginsPath).isWritable() # On windows testing the writable status isn't reliable.
readOnly = isTheSystemDir # Assume only the system plugins are not writable.
# only test those not yet loaded. Loaded plugins already proved they're o.k.
Expand Down
2 changes: 1 addition & 1 deletion python/utils.py
Expand Up @@ -255,7 +255,7 @@ def findPlugins(path):

try:
f = codecs.open(metadataFile, "r", "utf8")
cp.readfp(f)
cp.read_file(f)
f.close()
except:
cp = None
Expand Down

0 comments on commit e7c9400

Please sign in to comment.