Skip to content

Commit

Permalink
Fix: order of imports get mixed-up when removing duplicates.
Browse files Browse the repository at this point in the history
set() changes the order, use OrderedDict instead.
  • Loading branch information
htgoebel committed Sep 10, 2015
1 parent 9d0e0ad commit f14e895
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions PyInstaller/depend/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import os
import pkgutil
from collections import OrderedDict

from PyInstaller.compat import ctypes, PYCO
from PyInstaller.depend.utils import _resolveCtypesImports, scan_code
Expand Down Expand Up @@ -82,9 +83,10 @@ def _remove_duplicate_entries(self, item_list):
"""
Remove duplicate entries from the list.
"""
# The strategy is to convert a list to a set and then back.
# This conversion will eliminate duplicate entries.
return list(set(item_list))
# The strategy is to convert a list to anOrderedDict and then
# back. This conversion will eliminate duplicate entries. Do
# not use a set, as this will change the order of elements.
return list(OrderedDict(map(None, item_list, [])))

def scancode(self):
self.pyinstaller_imports, self.pyinstaller_warnings, self.pyinstaller_binaries, allnms = scan_code(self.co)
Expand Down

2 comments on commit f14e895

@htgoebel
Copy link
Member Author

Choose a reason for hiding this comment

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

We agreed on accepting no further commits for teh develop branch. But this one helps working on #1367.

@matysek
Copy link
Member

Choose a reason for hiding this comment

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

@htgoebel Go ahead if that helps you to get consistent results for comparing features in both branches.

Please sign in to comment.