aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-12-07 11:10:03 +0100
committerPierre Ossman <ossman@cendio.se>2015-12-07 11:10:03 +0100
commite844e450b602ed7d550babd246a4f7806688cc6d (patch)
treefa4b11438d7e4d17ee9433a58e33cd086da52e2e
parentef7faee90bf89d4dc1229d06991935f1b254d0fc (diff)
parentdd5a31bf62887cccf61b57b24ea680429f18c657 (diff)
downloadtigervnc-e844e450b602ed7d550babd246a4f7806688cc6d.tar.gz
tigervnc-e844e450b602ed7d550babd246a4f7806688cc6d.zip
Merge branch 'master' of https://github.com/hackonteur/tigervnc
-rwxr-xr-xcontrib/xorg/download-xorg-7.539
1 files changed, 37 insertions, 2 deletions
diff --git a/contrib/xorg/download-xorg-7.5 b/contrib/xorg/download-xorg-7.5
index 1b802a2b..65967d28 100755
--- a/contrib/xorg/download-xorg-7.5
+++ b/contrib/xorg/download-xorg-7.5
@@ -1,8 +1,10 @@
#!/usr/bin/env python
-# -*-mode: python; coding: UTF-8 -*-
+# -*-mode: python; coding: utf-8 -*-
import os
import glob
+import sys
+import urllib2
#INDI = "http://ftp.sunet.se/pub/X11/ftp.x.org/individual"
INDI = "http://ftp.x.org/pub/individual/"
@@ -63,6 +65,39 @@ packages = {
"freetype": "http://downloads.sourceforge.net/freetype/freetype-2.4.2.tar.bz2",
}
+# Python-based replacement for wget, which allows us to catch exceptions
+def webget(url, file_name):
+ file_name = "%s/%s" % (os.getcwd(), file_name)
+ print "Downloading: %s" % (url)
+ try:
+ u = urllib2.urlopen(url)
+ except urllib2.URLError:
+ print sys.exc_info()[0]
+ sys.exit("ERROR: Unable to open URL: %s" % url)
+ try:
+ f = open(file_name, 'wb')
+ except IOError:
+ sys.exit("ERROR: Unable to save to: %s" % file_name)
+ else:
+ meta = u.info()
+ file_size = int(meta.getheaders("Content-Length")[0])
+ print " Saving as: %s Bytes: %s" % (file_name, file_size)
+
+ file_size_dl = 0
+ block_sz = 4096
+ while True:
+ buffer = u.read(block_sz)
+ if not buffer:
+ break
+
+ file_size_dl += len(buffer)
+ f.write(buffer)
+ status = r" Progress: %7d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
+ status = status + chr(8)*(len(status)+1)
+ print status,
+
+ f.close()
+ print status
def main():
@@ -79,7 +114,7 @@ def main():
else :
fname = pkg + ".tar.gz"
if not os.path.exists(fname):
- assert 0 == os.spawnvp(os.P_WAIT, "wget", ["-N", "-c", "-O", fname, loc])
+ webget(loc, fname)
os.chdir(cwd)
main()