884 # step 1: extract plug-ins and downloaded files |
884 # step 1: extract plug-ins and downloaded files |
885 for pluginFile in os.listdir(downloadPath): |
885 for pluginFile in os.listdir(downloadPath): |
886 if not os.path.isfile(os.path.join(downloadPath, pluginFile)): |
886 if not os.path.isfile(os.path.join(downloadPath, pluginFile)): |
887 continue |
887 continue |
888 |
888 |
889 pluginName, pluginVersion = \ |
889 try: |
890 pluginFile.replace(".zip", "").rsplit("-", 1) |
890 pluginName, pluginVersion = \ |
891 pluginVersionList = re.split("[._-]", pluginVersion) |
891 pluginFile.replace(".zip", "").rsplit("-", 1) |
892 for index in range(len(pluginVersionList)): |
892 pluginVersionList = re.split("[._-]", pluginVersion) |
893 try: |
893 for index in range(len(pluginVersionList)): |
894 pluginVersionList[index] = int(pluginVersionList[index]) |
894 try: |
895 except ValueError: |
895 pluginVersionList[index] = int(pluginVersionList[index]) |
896 # use default of 0 |
896 except ValueError: |
897 pluginVersionList[index] = 0 |
897 # use default of 0 |
|
898 pluginVersionList[index] = 0 |
|
899 except ValueError: |
|
900 # rsplit() returned just one entry, i.e. file name doesn't contain |
|
901 # version info separated by '-' |
|
902 # => assume version 0.0.0 |
|
903 pluginName = pluginFile.replace(".zip", "") |
|
904 pluginVersionList = [0, 0, 0] |
898 |
905 |
899 if pluginName not in downloads: |
906 if pluginName not in downloads: |
900 downloads[pluginName] = [] |
907 downloads[pluginName] = [] |
901 downloads[pluginName].append((pluginFile, tuple(pluginVersionList))) |
908 downloads[pluginName].append((pluginFile, tuple(pluginVersionList))) |
902 |
909 |