Download file from url to filename fname if it does not already exist. Abort if file contents does not match supplied md5 checksum.
(url, checksum, fname)
| 793 | pass |
| 794 | |
| 795 | def verifyThirdPartyFile(url, checksum, fname): |
| 796 | """ |
| 797 | Download file from url to filename fname if it does not already exist. |
| 798 | Abort if file contents does not match supplied md5 checksum. |
| 799 | """ |
| 800 | name = os.path.basename(fname) |
| 801 | if os.path.exists(fname): |
| 802 | print("Using local copy of %s"%(name,)) |
| 803 | else: |
| 804 | print("Did not find local copy of %s"%(name,)) |
| 805 | print("Downloading %s"%(name,)) |
| 806 | downloadURL(url, fname) |
| 807 | print("Archive for %s stored as %s"%(name, fname)) |
| 808 | if len(checksum) == 32: |
| 809 | algo = 'md5' |
| 810 | elif len(checksum) == 64: |
| 811 | algo = 'sha256' |
| 812 | else: |
| 813 | raise ValueError(checksum) |
| 814 | if os.system( |
| 815 | 'CHECKSUM=$(openssl %s %s) ; test "${CHECKSUM##*= }" = "%s"' |
| 816 | % (algo, shellQuote(fname), checksum) ): |
| 817 | fatal('%s checksum mismatch for file %s' % (algo, fname)) |
| 818 | |
| 819 | def build_universal_openssl(basedir, archList): |
| 820 | """ |
no test coverage detected
searching dependent graphs…