Skip to content

Commit

Permalink
Fix SHA1 package verification under Cygwin Env. Resolve #26
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Nov 21, 2014
1 parent 32230c6 commit 7f918da
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions platformio/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ def verify(self, sha1=None):

dlsha1 = None
try:
res = check_output(["sha1sum", self._destination])
dlsha1 = res[:40]
dlsha1 = check_output(["sha1sum", self._destination])
except OSError:
try:
res = check_output(["shasum", "-a", "1", self._destination])
dlsha1 = res[:40]
dlsha1 = check_output(["shasum", "-a", "1", self._destination])
except OSError:
pass

if dlsha1 and sha1 != dlsha1:
raise FDSHASumMismatch(dlsha1, self._fname, sha1)
if dlsha1:
dlsha1 = dlsha1[1:41] if dlsha1.startswith("\\") else dlsha1[:40]
if sha1 != dlsha1:
raise FDSHASumMismatch(dlsha1, self._fname, sha1)

def _preserve_filemtime(self, lmdate):
timedata = parsedate_tz(lmdate)
Expand Down

0 comments on commit 7f918da

Please sign in to comment.