forked from arturoc/ofxGStreamer
-
Notifications
You must be signed in to change notification settings - Fork 2
/
packager.py
58 lines (45 loc) · 1.95 KB
/
packager.py
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
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
from cerbero.config import Distro
from cerbero.errors import FatalError
from cerbero.utils import _
from cerbero.utils import messages as m
_packagers = {}
def register_packager(distro, klass, distro_version=None):
if not distro in _packagers:
_packagers[distro] = {}
_packagers[distro][distro_version] = klass
class Packager (object):
def __new__(klass, config, package, store):
d = config.target_distro
v = config.target_distro_version
if d not in _packagers:
raise FatalError(_("No packager available for the distro %s" % d))
if v not in _packagers[d]:
# Be tolerant with the distro version
m.warning(_("No specific packager available for the distro "
"version %s, using generic packager for distro %s" % (v, d)))
v = None
return _packagers[d][v](config, package, store)
from cerbero.packages import wix_packager, rpm, debian, android
from cerbero.packages.osx import packager as osx_packager
wix_packager.register()
osx_packager.register()
rpm.register()
debian.register()
android.register()