123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- 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(DownloadablePackage):
- downloadURL = 'ftp://ftp.alsa-project.org/pub/lib/'
- niceName = 'ALSA'
- sourceName = 'alsa-lib'
- version = '1.1.7'
- fileLength = 1005257
- checksums = {
- 'sha256':
- '9d6000b882a3b2df56300521225d69717be6741b71269e488bb20a20783bdc09',
- }
- @classmethod
- def getTarballName(cls):
- return '%s-%s.tar.bz2' % (cls.sourceName, cls.version)
- @classmethod
- def getMakeName(cls):
- return 'ALSA'
- class FreeType(DownloadablePackage):
- downloadURL = 'http://downloads.sourceforge.net/freetype'
- niceName = 'FreeType'
- sourceName = 'freetype'
- version = '2.9.1'
- fileLength = 2533956
- checksums = {
- 'sha256':
- 'ec391504e55498adceb30baceebd147a6e963f636eb617424bcfc47a169898ce',
- }
- class GLEW(DownloadablePackage):
- downloadURL = 'http://downloads.sourceforge.net/glew'
- niceName = 'GLEW'
- sourceName = 'glew'
- version = '2.1.0'
- fileLength = 764073
- checksums = {
- 'sha256':
- '04de91e7e6763039bc11940095cd9c7f880baba82196a7765f727ac05a993c95',
- }
- @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.36'
- fileLength = 1496022
- checksums = {
- 'sha256':
- 'ca13c548bde5fb6ff7117cc0bdab38808acb699c0eccb613f0e4697826e1fd7d',
- }
- @classmethod
- def getMakeName(cls):
- return 'PNG'
- class OGG(DownloadablePackage):
- downloadURL = 'http://downloads.xiph.org/releases/ogg'
- niceName = 'libogg'
- sourceName = 'libogg'
- version = '1.3.3'
- fileLength = 579853
- checksums = {
- 'sha256':
- 'c2e8a485110b97550f453226ec644ebac6cb29d1caef2902c007edab4308d985',
- }
- @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 = 'http://www.libsdl.org/release'
- niceName = 'SDL2'
- sourceName = 'SDL2'
- version = '2.0.10'
- fileLength = 5550762
- checksums = {
- 'sha256':
- 'b4656c13a1f0d0023ae2f4a9cf08ec92fffb464e0f24238337784159b8b91d57',
- }
- class SDL2_ttf(DownloadablePackage):
- downloadURL = 'http://www.libsdl.org/projects/SDL_ttf/release'
- niceName = 'SDL2_ttf'
- sourceName = 'SDL2_ttf'
- version = '2.0.15'
- fileLength = 4479718
- checksums = {
- 'sha256':
- 'a9eceb1ad88c1f1545cd7bd28e7cbc0b2c14191d40238f531a15b01b1b22cd33',
- }
- class TCL(DownloadablePackage):
- downloadURL = 'http://downloads.sourceforge.net/tcl'
- niceName = 'Tcl'
- sourceName = 'tcl'
- version = '8.6.9'
- fileLength = 10000896
- checksums = {
- 'sha256':
- 'ad0cd2de2c87b9ba8086b43957a0de3eb2eb565c7159d5f53ccbba3feb915f4e',
- }
- @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.6'
- fileLength = 1634357
- checksums = {
- 'sha256':
- '6ed40e0241089a42c48604dc00e362beee00036af2d8b3f46338031c9e0351cb',
- }
- @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
|