paula: removed old per-repo trunk subdirs
[paula.git] / paula.ploneexamples / src / paula / ploneexamples / Extensions / Install.py
blobfb41dac6ef7061716ed27db097c80a309ab40727
1 # Copyright (c) 2008 by Florian Friesdorf
3 # GNU Affero General Public License (AGPL)
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as
7 # published by the Free Software Foundation; either version 3 of the
8 # License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
15 # You should have received a copy of the GNU Affero General Public
16 # License along with this program. If not, see
17 # <http://www.gnu.org/licenses/>.
18 """
19 """
20 __author__ = "Florian Friesdorf <flo@chaoflow.net>"
21 __docformat__ = "plaintext"
23 import transaction
24 from Products.CMFCore.utils import getToolByName
26 PRODUCT_DEPENDENCIES = ()
28 EXTENSION_PROFILES = (
29 'paula.ploneexamples:default',
32 def install(self, reinstall=False):
33 """Install a set of products (which themselves may either use Install.py
34 or GenericSetup extension profiles for their configuration) and then
35 install a set of extension profiles.
37 One of the extension profiles we install is that of this product. This
38 works because an Install.py installation script (such as this one) takes
39 precedence over extension profiles for the same product in
40 portal_quickinstaller.
42 We do this because it is not possible to install other products during
43 the execution of an extension profile (i.e. we cannot do this during
44 the importVarious step for this profile).
45 """
47 portal_quickinstaller = getToolByName(self, 'portal_quickinstaller')
48 portal_setup = getToolByName(self, 'portal_setup')
50 for product in PRODUCT_DEPENDENCIES:
51 if reinstall and portal_quickinstaller.isProductInstalled(product):
52 portal_quickinstaller.reinstallProducts([product])
53 transaction.savepoint()
54 elif not portal_quickinstaller.isProductInstalled(product):
55 portal_quickinstaller.installProduct(product)
56 transaction.savepoint()
58 for extension_id in EXTENSION_PROFILES:
59 portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id, purge_old=False)
60 product_name = extension_id.split(':')[0]
61 portal_quickinstaller.notifyInstalled(product_name)
62 transaction.savepoint()