Skip to content

Commit 699e8d4

Browse files
committed
Try harder to cache FreeType tarball on Python 2.
1 parent 3a1a093 commit 699e8d4

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

setupext.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,12 +1146,15 @@ def do_custom_build(self):
11461146
os.path.isfile(tarball_cache_path)):
11471147
if get_file_hash(tarball_cache_path) == LOCAL_FREETYPE_HASH:
11481148
try:
1149-
# fail on Lpy, oh well
1150-
os.makedirs('build', exist_ok=True)
1149+
os.makedirs('build')
1150+
except OSError:
1151+
# Don't care if it exists.
1152+
pass
1153+
try:
11511154
shutil.copy(tarball_cache_path, tarball_path)
11521155
print('Using cached tarball: {}'
11531156
.format(tarball_cache_path))
1154-
except:
1157+
except OSError:
11551158
# If this fails, oh well just re-download
11561159
pass
11571160

@@ -1186,12 +1189,15 @@ def do_custom_build(self):
11861189
raise IOError("Failed to download freetype")
11871190
if get_file_hash(tarball_path) == LOCAL_FREETYPE_HASH:
11881191
try:
1189-
# this will fail on LPy, oh well
1190-
os.makedirs(tarball_cache_dir, exist_ok=True)
1192+
os.makedirs(tarball_cache_dir)
1193+
except OSError:
1194+
# Don't care if it exists.
1195+
pass
1196+
try:
11911197
shutil.copy(tarball_path, tarball_cache_path)
11921198
print('Cached tarball at: {}'
11931199
.format(tarball_cache_path))
1194-
except:
1200+
except OSError:
11951201
# again, we do not care if this fails, can
11961202
# always re download
11971203
pass

0 commit comments

Comments
 (0)