Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Commit 0135756

Browse files
author
Jim Porter
committed
Use cached patchelf tarball if it's found and the SHA matches
1 parent 08b8d5f commit 0135756

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

setup.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,18 @@ def run(self):
108108

109109
filename = os.path.basename(self.patchelf_url)
110110
with pushd(self.download_dir, makedirs=True, exist_ok=True):
111-
self.announce('Downloading {}...'.format(self.patchelf_url),
112-
log.INFO)
113-
urlretrieve(self.patchelf_url, filename)
111+
if ( os.path.exists(filename) and
112+
self.sha256sum(filename) == self.sha256_hash ):
113+
self.announce('Using cached {}'.format(filename))
114+
else:
115+
self.announce('Downloading {}...'.format(self.patchelf_url),
116+
log.INFO)
117+
urlretrieve(self.patchelf_url, filename)
114118

115-
if self.sha256sum(filename) != self.sha256_hash:
116-
raise RuntimeError(
117-
"{} doesn't match checksum".format(filename)
118-
)
119+
if self.sha256sum(filename) != self.sha256_hash:
120+
raise RuntimeError(
121+
"{} doesn't match checksum".format(filename)
122+
)
119123

120124

121125
class BuildPatchelfCommand(Command):

0 commit comments

Comments
 (0)