Skip to content

Commit 6b40c8a

Browse files
committed
Add mirrors to freetype download
Fixed build error due to gnu savannah being down
1 parent 0b88da5 commit 6b40c8a

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

setupext.py

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,19 +1047,31 @@ def do_custom_build(self):
10471047
pass
10481048

10491049
if not os.path.isfile(tarball_path):
1050-
url_fmt = (
1051-
'http://download.savannah.gnu.org/releases/freetype/{0}')
1052-
tarball_url = url_fmt.format(tarball)
1053-
1054-
print("Downloading {0}".format(tarball_url))
1055-
if sys.version_info[0] == 2:
1056-
from urllib import urlretrieve
1057-
else:
1058-
from urllib.request import urlretrieve
1059-
1060-
if not os.path.exists('build'):
1061-
os.makedirs('build')
1062-
urlretrieve(tarball_url, tarball_path)
1050+
sourceforge_url = (
1051+
'http://downloads.sourceforge.net/project/freetype'
1052+
'/freetype2/{0}/'.format(LOCAL_FREETYPE_VERSION)
1053+
)
1054+
url_fmts = (
1055+
'http://download.savannah.gnu.org/releases/freetype/{0}',
1056+
sourceforge_url + '{0}'
1057+
)
1058+
for url_fmt in url_fmts:
1059+
tarball_url = url_fmt.format(tarball)
1060+
1061+
print("Downloading {0}".format(tarball_url))
1062+
if sys.version_info[0] == 2:
1063+
from urllib import urlretrieve
1064+
else:
1065+
from urllib.request import urlretrieve
1066+
1067+
if not os.path.exists('build'):
1068+
os.makedirs('build')
1069+
try:
1070+
urlretrieve(tarball_url, tarball_path)
1071+
except:
1072+
print("Failed to download {0}".format(tarball_url))
1073+
if not os.path.isfile(tarball_path):
1074+
raise IOError("Failed to download freetype")
10631075
if get_file_hash(tarball_path) == LOCAL_FREETYPE_HASH:
10641076
try:
10651077
# this will fail on LPy, oh well

0 commit comments

Comments
 (0)