1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
from urllib.parse import urljoin
class Package(object):
'''Abstract base class for packages.
'''
niceName = None
sourceName = None
@classmethod
def getMakeName(cls):
return cls.sourceName.upper().replace('-', '_')
class DownloadablePackage(Package):
'''Abstract base class for packages that can be downloaded.
'''
downloadURL = None
version = None
fileLength = None
checksums = None
@classmethod
def getSourceDirName(cls):
'''Returns the desired name of the top-level source directory.
This might not match the actual name inside the downloaded archive,
but we can perform a rename on extraction to fix that.
'''
return '%s-%s' % (cls.sourceName, cls.version)
@classmethod
def getTarballName(cls):
return '%s-%s.tar.gz' % (cls.sourceName, cls.version)
@classmethod
def getURL(cls):
return urljoin(cls.downloadURL + '/', cls.getTarballName())
class ALSA(Package):
niceName = 'ALSA'
sourceName = 'alsa-lib'
@classmethod
def getMakeName(cls):
return 'ALSA'
class FreeType(DownloadablePackage):
downloadURL = 'http://downloads.sourceforge.net/freetype'
niceName = 'FreeType'
sourceName = 'freetype'
version = '2.11.1'
fileLength = 3451359
checksums = {
'sha256':
'f8db94d307e9c54961b39a1cc799a67d46681480696ed72ecf78d4473770f09b',
}
class GLEW(DownloadablePackage):
downloadURL = 'http://downloads.sourceforge.net/glew'
niceName = 'GLEW'
sourceName = 'glew'
version = '2.2.0'
fileLength = 835861
checksums = {
'sha256':
'd4fc82893cfb00109578d0a1a2337fb8ca335b3ceccf97b97e5cc7f08e4353e1',
}
@classmethod
def getTarballName(cls):
return '%s-%s.tgz' % (cls.sourceName, cls.version)
class LibPNG(DownloadablePackage):
downloadURL = 'http://downloads.sourceforge.net/libpng'
niceName = 'libpng'
sourceName = 'libpng'
version = '1.6.39'
fileLength = 1507328
checksums = {
'sha256':
'af4fb7f260f839919e5958e5ab01a275d4fe436d45442a36ee62f73e5beb75ba',
}
@classmethod
def getMakeName(cls):
return 'PNG'
class OGG(DownloadablePackage):
downloadURL = 'http://downloads.xiph.org/releases/ogg'
niceName = 'libogg'
sourceName = 'libogg'
version = '1.3.5'
fileLength = 593071
checksums = {
'sha256':
'0eb4b4b9420a0f51db142ba3f9c64b333f826532dc0f48c6410ae51f4799b664',
}
@classmethod
def getMakeName(cls):
return 'OGG'
class OpenGL(Package):
niceName = 'OpenGL'
sourceName = 'gl'
class PkgConfig(DownloadablePackage):
downloadURL = 'https://pkg-config.freedesktop.org/releases'
niceName = 'pkg-config'
sourceName = 'pkg-config'
version = '0.29.2'
fileLength = 2016830
checksums = {
'sha256':
'6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591',
}
class SDL2(DownloadablePackage):
downloadURL = 'https://www.libsdl.org/release'
niceName = 'SDL2'
sourceName = 'SDL2'
version = '2.30.1'
fileLength = 7428023
checksums = {
'sha256':
'01215ffbc8cfc4ad165ba7573750f15ddda1f971d5a66e9dcaffd37c587f473a',
}
class SDL2_ttf(DownloadablePackage):
downloadURL = 'http://www.libsdl.org/projects/SDL_ttf/release'
niceName = 'SDL2_ttf'
sourceName = 'SDL2_ttf'
version = '2.22.0'
fileLength = 14314901
checksums = {
'sha256':
'd48cbd1ce475b9e178206bf3b72d56b66d84d44f64ac05803328396234d67723',
}
class TCL(DownloadablePackage):
downloadURL = 'http://downloads.sourceforge.net/tcl'
niceName = 'Tcl'
sourceName = 'tcl'
version = '8.6.13'
fileLength = 10834396
checksums = {
'sha256':
'43a1fae7412f61ff11de2cfd05d28cfc3a73762f354a417c62370a54e2caf066',
}
@classmethod
def getSourceDirName(cls):
return '%s%s' % (cls.sourceName, cls.version)
@classmethod
def getTarballName(cls):
return '%s%s-src.tar.gz' % (cls.sourceName, cls.version)
class Theora(DownloadablePackage):
downloadURL = 'http://downloads.xiph.org/releases/theora'
niceName = 'libtheora'
sourceName = 'libtheora'
version = '1.1.1'
fileLength = 2111877
checksums = {
'sha256':
'40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b',
}
@classmethod
def getMakeName(cls):
return 'THEORA'
class Vorbis(DownloadablePackage):
downloadURL = 'http://downloads.xiph.org/releases/vorbis'
niceName = 'libvorbis'
sourceName = 'libvorbis'
version = '1.3.7'
fileLength = 1658963
checksums = {
'sha256':
'0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab',
}
@classmethod
def getMakeName(cls):
return 'VORBIS'
class ZLib(DownloadablePackage):
downloadURL = 'http://downloads.sourceforge.net/libpng'
niceName = 'zlib'
sourceName = 'zlib'
version = '1.2.11'
fileLength = 607698
checksums = {
'sha256':
'c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1',
}
# Build a dictionary of packages using introspection.
_packagesByName = {
obj.getMakeName(): obj
for obj in locals().values()
if isinstance(obj, type)
and issubclass(obj, Package)
and obj is not Package
and obj is not DownloadablePackage
}
def getPackage(makeName):
return _packagesByName[makeName]
def iterDownloadablePackages():
for package in _packagesByName.values():
if issubclass(package, DownloadablePackage):
yield package
|