Skip to content

Commit

Permalink
Merge pull request #119 from jswetzen/pypi-mkdir
Browse files Browse the repository at this point in the history
Handle mkdir error like Python 3.5
  • Loading branch information
takluyver committed May 26, 2017
2 parents 51b05bd + 6ee2960 commit 7afbce6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nsist/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ def fetch(self):
download_to = get_cache_dir() / 'pypi' / self.name / self.version
try:
download_to.mkdir(parents=True)
except OSError as e:
# Py2 compatible equivalent of FileExistsError
if e.errno != errno.EEXIST:
except OSError:
# Ignore OSError only if the directory exists
if not download_to.is_dir():
raise
target = download_to / preferred_release.filename

Expand Down Expand Up @@ -188,8 +188,8 @@ def extract_wheel(whl_file, target_dir):
# shutil.copytree will not combine them.
try:
target.joinpath(p.name).mkdir()
except OSError as e:
if e.errno != errno.EEXIST:
except OSError:
if not target.joinpath(p.name).is_dir():
raise
merge_dir_to(p, target / p.name)
else:
Expand Down

0 comments on commit 7afbce6

Please sign in to comment.