Skip to content

Commit

Permalink
Ignore IOErrors when checking for already installed files
Browse files Browse the repository at this point in the history
  • Loading branch information
Pidgeot committed Oct 11, 2014
1 parent 6467120 commit 15d74fb
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,30 @@ def get_text_files(directory):
def detect_installed_file(current_file, test_files):
"""Returns the file in <test_files> which is contained in
<current_file>, or "Unknown"."""
current = open(current_file).read()
for f in test_files:
tested = open(f).read()
if tested in current:
return f
try:
current = open(current_file).read()
for f in test_files:
tested = open(f).read()
if tested in current:
return f
except IOError:
pass
return "Unknown"

def detect_installed_files(current_file, test_files):
"""Returns a list of files in <test_files> that are contained in
<current_file>."""
current = open(current_file).read()
installed = []
for f in test_files:
tested = open(f).read()
if tested in current:
installed.append(f)
try:
current = open(current_file).read()
for f in test_files:
try:
tested = open(f).read()
if tested in current:
installed.append(f)
except IOError:
pass
except IOError:
pass
return installed

0 comments on commit 15d74fb

Please sign in to comment.