Skip to content

Commit 8c304de

Browse files
committed
refactor common code outside loop
1 parent b3967e7 commit 8c304de

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

setupext.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,14 @@ def do_custom_build(self):
10471047
pass
10481048

10491049
if not os.path.isfile(tarball_path):
1050+
1051+
if sys.version_info[0] == 2:
1052+
from urllib import urlretrieve
1053+
else:
1054+
from urllib.request import urlretrieve
1055+
if not os.path.exists('build'):
1056+
os.makedirs('build')
1057+
10501058
sourceforge_url = (
10511059
'http://downloads.sourceforge.net/project/freetype'
10521060
'/freetype2/{0}/'.format(LOCAL_FREETYPE_VERSION)
@@ -1059,13 +1067,6 @@ def do_custom_build(self):
10591067
tarball_url = url_fmt.format(tarball)
10601068

10611069
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')
10691070
try:
10701071
urlretrieve(tarball_url, tarball_path)
10711072
except:

0 commit comments

Comments
 (0)