packages.py 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. from urlparse import urljoin
  2. class Package(object):
  3. '''Abstract base class for packages.
  4. '''
  5. niceName = None
  6. sourceName = None
  7. @classmethod
  8. def getMakeName(cls):
  9. return cls.sourceName.upper()
  10. class DownloadablePackage(Package):
  11. '''Abstract base class for packages that can be downloaded.
  12. '''
  13. downloadURL = None
  14. version = None
  15. fileLength = None
  16. checksums = None
  17. @classmethod
  18. def getSourceDirName(cls):
  19. '''Returns the desired name of the top-level source directory.
  20. This might not match the actual name inside the downloaded archive,
  21. but we can perform a rename on extraction to fix that.
  22. '''
  23. return '%s-%s' % (cls.sourceName, cls.version)
  24. @classmethod
  25. def getTarballName(cls):
  26. return '%s-%s.tar.gz' % (cls.sourceName, cls.version)
  27. @classmethod
  28. def getURL(cls):
  29. return urljoin(cls.downloadURL + '/', cls.getTarballName())
  30. class ALSA(DownloadablePackage):
  31. downloadURL = 'ftp://ftp.alsa-project.org/pub/lib/'
  32. niceName = 'ALSA'
  33. sourceName = 'alsa-lib'
  34. version = '1.1.0'
  35. fileLength = 929874
  36. checksums = {
  37. 'sha256':
  38. 'dfde65d11e82b68f82e562ab6228c1fb7c78854345d3c57e2c68a9dd3dae1f15',
  39. }
  40. @classmethod
  41. def getTarballName(cls):
  42. return '%s-%s.tar.bz2' % (cls.sourceName, cls.version)
  43. @classmethod
  44. def getMakeName(cls):
  45. return 'ALSA'
  46. class FreeType(DownloadablePackage):
  47. downloadURL = 'http://downloads.sourceforge.net/freetype'
  48. niceName = 'FreeType'
  49. sourceName = 'freetype'
  50. version = '2.4.12'
  51. fileLength = 2117909
  52. checksums = {
  53. 'sha256':
  54. '9755806ff72cba095aad47dce6f0ad66bd60fee2a90323707d2cac5c526066f0',
  55. }
  56. class GLEW(DownloadablePackage):
  57. downloadURL = 'http://downloads.sourceforge.net/glew'
  58. niceName = 'GLEW'
  59. sourceName = 'glew'
  60. version = '1.9.0'
  61. fileLength = 544440
  62. checksums = {
  63. 'sha256':
  64. '9b36530e414c95d6624be9d6815a5be1531d1986300ae5903f16977ab8aeb787',
  65. }
  66. @classmethod
  67. def getTarballName(cls):
  68. return '%s-%s.tgz' % (cls.sourceName, cls.version)
  69. class LibPNG(DownloadablePackage):
  70. downloadURL = 'http://downloads.sourceforge.net/libpng'
  71. niceName = 'libpng'
  72. sourceName = 'libpng'
  73. version = '1.6.20'
  74. fileLength = 1417478
  75. checksums = {
  76. 'sha256':
  77. '3d3bdc16f973a62fb1d26464fe2fe19f51dde9b883feff3e059d18ec1457b199',
  78. }
  79. @classmethod
  80. def getMakeName(cls):
  81. return 'PNG'
  82. class OGG(DownloadablePackage):
  83. downloadURL = 'http://downloads.xiph.org/releases/ogg'
  84. niceName = 'libogg'
  85. sourceName = 'libogg'
  86. version = '1.3.0'
  87. fileLength = 425144
  88. checksums = {
  89. 'sha256':
  90. 'a8de807631014615549d2356fd36641833b8288221cea214f8a72750efe93780',
  91. }
  92. @classmethod
  93. def getMakeName(cls):
  94. return 'OGG'
  95. class OpenGL(Package):
  96. niceName = 'OpenGL'
  97. sourceName = 'gl'
  98. class SDL(DownloadablePackage):
  99. downloadURL = 'http://www.libsdl.org/release'
  100. niceName = 'SDL'
  101. sourceName = 'SDL'
  102. version = '1.2.15'
  103. fileLength = 3920622
  104. checksums = {
  105. 'sha256':
  106. 'd6d316a793e5e348155f0dd93b979798933fb98aa1edebcc108829d6474aad00',
  107. }
  108. class SDL2(DownloadablePackage):
  109. downloadURL = 'http://www.libsdl.org/release'
  110. niceName = 'SDL2'
  111. sourceName = 'SDL2'
  112. version = '2.0.9'
  113. fileLength = 5246942
  114. checksums = {
  115. 'sha256':
  116. '255186dc676ecd0c1dbf10ec8a2cc5d6869b5079d8a38194c2aecdff54b324b1',
  117. }
  118. class SDL_ttf(DownloadablePackage):
  119. downloadURL = 'http://www.libsdl.org/projects/SDL_ttf/release'
  120. niceName = 'SDL_ttf'
  121. sourceName = 'SDL_ttf'
  122. version = '2.0.11'
  123. fileLength = 4053686
  124. checksums = {
  125. 'sha256':
  126. '724cd895ecf4da319a3ef164892b72078bd92632a5d812111261cde248ebcdb7',
  127. }
  128. class SDL2_ttf(DownloadablePackage):
  129. downloadURL = 'http://www.libsdl.org/projects/SDL_ttf/release'
  130. niceName = 'SDL2_ttf'
  131. sourceName = 'SDL2_ttf'
  132. version = '2.0.14'
  133. fileLength = 4147462
  134. checksums = {
  135. 'sha256':
  136. '34db5e20bcf64e7071fe9ae25acaa7d72bdc4f11ab3ce59acc768ab62fe39276',
  137. }
  138. class TCL_ANDROID(DownloadablePackage):
  139. downloadURL = 'http://downloads.sourceforge.net/tcl'
  140. niceName = 'Tcl'
  141. sourceName = 'tcl'
  142. version = '8.5.11'
  143. fileLength = 4484001
  144. checksums = {
  145. 'sha256':
  146. '8addc385fa6b5be4605e6d68fbdc4c0e674c5af1dc1c95ec5420390c4b08042a',
  147. }
  148. @classmethod
  149. def getMakeName(cls):
  150. return 'TCL_ANDROID'
  151. @classmethod
  152. def getSourceDirName(cls):
  153. return '%s%s' % (cls.sourceName, cls.version)
  154. @classmethod
  155. def getTarballName(cls):
  156. return '%s%s-src.tar.gz' % (cls.sourceName, cls.version)
  157. class TCL(DownloadablePackage):
  158. downloadURL = 'http://downloads.sourceforge.net/tcl'
  159. niceName = 'Tcl'
  160. sourceName = 'tcl'
  161. version = '8.5.18'
  162. fileLength = 4534628
  163. checksums = {
  164. 'sha256':
  165. '032be57a607bdf252135b52fac9e3a7016e526242374ac7637b083ecc4c5d3c9',
  166. }
  167. @classmethod
  168. def getSourceDirName(cls):
  169. return '%s%s' % (cls.sourceName, cls.version)
  170. @classmethod
  171. def getTarballName(cls):
  172. return '%s%s-src.tar.gz' % (cls.sourceName, cls.version)
  173. class Theora(DownloadablePackage):
  174. downloadURL = 'http://downloads.xiph.org/releases/theora'
  175. niceName = 'libtheora'
  176. sourceName = 'libtheora'
  177. version = '1.1.1'
  178. fileLength = 2111877
  179. checksums = {
  180. 'sha256':
  181. '40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b',
  182. }
  183. @classmethod
  184. def getMakeName(cls):
  185. return 'THEORA'
  186. class Vorbis(DownloadablePackage):
  187. downloadURL = 'http://downloads.xiph.org/releases/vorbis'
  188. niceName = 'libvorbis'
  189. sourceName = 'libvorbis'
  190. version = '1.3.3'
  191. fileLength = 1592663
  192. checksums = {
  193. 'sha256':
  194. '6d747efe7ac4ad249bf711527882cef79fb61d9194c45b5ca5498aa60f290762',
  195. }
  196. @classmethod
  197. def getMakeName(cls):
  198. return 'VORBIS'
  199. class ZLib(DownloadablePackage):
  200. downloadURL = 'http://downloads.sourceforge.net/libpng'
  201. niceName = 'zlib'
  202. sourceName = 'zlib'
  203. version = '1.2.8'
  204. fileLength = 571091
  205. checksums = {
  206. 'sha256':
  207. '36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d',
  208. }
  209. # Build a dictionary of packages using introspection.
  210. def _discoverPackages(localObjects):
  211. for obj in localObjects:
  212. if isinstance(obj, type) and issubclass(obj, Package):
  213. if not (obj is Package or obj is DownloadablePackage):
  214. yield obj.getMakeName(), obj
  215. _packagesByName = dict(_discoverPackages(locals().itervalues()))
  216. def getPackage(makeName):
  217. return _packagesByName[makeName]
  218. def iterDownloadablePackages():
  219. for package in _packagesByName.itervalues():
  220. if issubclass(package, DownloadablePackage):
  221. yield package