You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

download-xorg-7.5 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/usr/bin/env python2
  2. # -*-mode: python; coding: utf-8 -*-
  3. import os
  4. import glob
  5. import sys
  6. import urllib2
  7. #INDI = "http://ftp.sunet.se/pub/X11/ftp.x.org/individual"
  8. INDI = "http://ftp.x.org/pub/individual/"
  9. PROTO = INDI + "proto/"
  10. LIB = INDI + "lib/"
  11. SERVER = INDI + "xserver/"
  12. UTIL = INDI + "util/"
  13. DATA = INDI + "data/"
  14. APP = INDI + "app/"
  15. packages = {
  16. "damageproto": PROTO + "damageproto-1.2.0.tar.bz2",
  17. "fixesproto": PROTO + "fixesproto-4.1.1.tar.bz2",
  18. "resourceproto": PROTO + "resourceproto-1.1.0.tar.bz2",
  19. "fontsproto": PROTO + "fontsproto-2.1.0.tar.bz2",
  20. "bigreqsproto": PROTO + "bigreqsproto-1.1.0.tar.bz2",
  21. "kbproto": PROTO + "kbproto-1.0.4.tar.bz2",
  22. "inputproto": PROTO + "inputproto-2.0.tar.bz2",
  23. "glproto": PROTO + "glproto-1.4.12.tar.bz2",
  24. "xineramaproto": PROTO + "xineramaproto-1.2.tar.bz2",
  25. "randrproto": PROTO + "randrproto-1.3.1.tar.bz2",
  26. "scrnsaverproto": PROTO + "scrnsaverproto-1.2.0.tar.bz2",
  27. "renderproto": PROTO + "renderproto-0.11.tar.bz2",
  28. "xcmiscproto": PROTO + "xcmiscproto-1.2.0.tar.bz2",
  29. "xextproto": PROTO + "xextproto-7.1.1.tar.bz2",
  30. "xf86driproto": PROTO + "xf86driproto-2.1.0.tar.bz2",
  31. "dri2proto": PROTO + "dri2proto-2.1.tar.bz2",
  32. "compositeproto": PROTO + "compositeproto-0.4.1.tar.bz2",
  33. "xf86vidmodeproto": PROTO + "xf86vidmodeproto-2.3.tar.bz2",
  34. "videoproto": PROTO + "videoproto-2.3.0.tar.bz2",
  35. "xproto": PROTO + "xproto-7.0.16.tar.bz2",
  36. "libxkbfile": LIB + "libxkbfile-1.0.6.tar.bz2",
  37. "libXxf86vm": LIB + "libXxf86vm-1.1.0.tar.bz2",
  38. "libXext": LIB + "libXext-1.1.2.tar.bz2",
  39. "libfontenc": LIB + "libfontenc-1.0.5.tar.bz2",
  40. "libXau": LIB + "libXau-1.0.6.tar.bz2",
  41. "libXfont": LIB + "libXfont-1.4.2.tar.bz2",
  42. "libXfixes": LIB + "libXfixes-4.0.5.tar.bz2",
  43. "libSM": LIB + "libSM-1.1.1.tar.bz2",
  44. "libXi": LIB + "libXi-1.3.2.tar.bz2",
  45. "libXmu": LIB + "libXmu-1.0.5.tar.bz2",
  46. "libX11": LIB + "libX11-1.3.5.tar.bz2",
  47. "libXdmcp": LIB + "libXdmcp-1.0.3.tar.bz2",
  48. "xtrans": LIB + "xtrans-1.2.5.tar.bz2",
  49. "libXt": LIB + "libXt-1.0.8.tar.bz2",
  50. "libpciaccess": LIB + "libpciaccess-0.12.0.tar.bz2",
  51. "libICE": LIB + "libICE-1.0.6.tar.bz2",
  52. "pixman": LIB + "pixman-0.19.2.tar.bz2",
  53. "libXdamage": LIB + "libXdamage-1.1.3.tar.bz2",
  54. "util-macros": UTIL + "util-macros-1.10.0.tar.bz2",
  55. "xorg-server": SERVER + "xorg-server-1.8.2.tar.bz2",
  56. "libdrm": "http://dri.freedesktop.org/libdrm/libdrm-2.4.21.tar.bz2",
  57. "Mesa": "ftp://ftp.freedesktop.org/pub/mesa/older-versions/7.x/7.9/MesaLib-7.9.tar.bz2",
  58. "libpthread-stubs": "http://xcb.freedesktop.org/dist/libpthread-stubs-0.3.tar.bz2",
  59. "freetype": "http://downloads.sourceforge.net/freetype/freetype-2.4.2.tar.bz2",
  60. }
  61. # Python-based replacement for wget, which allows us to catch exceptions
  62. def webget(url, file_name):
  63. file_name = "%s/%s" % (os.getcwd(), file_name)
  64. print "Downloading: %s" % (url)
  65. try:
  66. u = urllib2.urlopen(url)
  67. except urllib2.URLError:
  68. print sys.exc_info()[0]
  69. sys.exit("ERROR: Unable to open URL: %s" % url)
  70. try:
  71. f = open(file_name, 'wb')
  72. except IOError:
  73. sys.exit("ERROR: Unable to save to: %s" % file_name)
  74. else:
  75. meta = u.info()
  76. file_size = int(meta.getheaders("Content-Length")[0])
  77. print " Saving as: %s Bytes: %s" % (file_name, file_size)
  78. file_size_dl = 0
  79. block_sz = 4096
  80. while True:
  81. buffer = u.read(block_sz)
  82. if not buffer:
  83. break
  84. file_size_dl += len(buffer)
  85. f.write(buffer)
  86. status = r" Progress: %7d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
  87. status = status + chr(8)*(len(status)+1)
  88. print status,
  89. f.close()
  90. print status
  91. def main():
  92. dir = os.path.expanduser("~")+"/.tigervnc-xorg-7.5"
  93. cwd = os.getcwd()
  94. if not os.path.exists(dir):
  95. os.mkdir(dir)
  96. os.chdir(dir)
  97. for pkg in packages.keys():
  98. loc = packages[pkg]
  99. if ".tar.bz2" in loc:
  100. fname = pkg + ".tar.bz2"
  101. else :
  102. fname = pkg + ".tar.gz"
  103. if not os.path.exists(fname):
  104. webget(loc, fname)
  105. os.chdir(cwd)
  106. main()